npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rapidfy-js

v1.0.2

Published

RapidfyJS is a simple and fast way to create a new project

Readme

🚀 RapidfyJS — Lightweight Node.js Web Framework

npm version CI Node.js Package

Fast, unopinionated, minimalist web framework for Node.js.

Table of contents

Introduction

RapidfyJS is a lightweight web framework built on the Node.js http core module. It supports middleware, routing, validation, file uploads, XML/JSON parsing, and multiple database integrations (MongoDB, MySQL, PostgreSQL).

Getting Started

To start using RapidfyJS, follow these steps:

📦 Installation

npm install rapidfy-js

Create a new file, index.js, and copy the following code:

Or clone the example repository and run:

git clone https://github.com/KimmyLps/rapidfy-js-repo.git
cd rapidfy-js-repo
npm install

🏗️ Basic Usage

const path = require('path');
const rapidfyJs = require('./src/core/Application');

// Create the app
const app = rapidfyJs();
const router = rapidfyJs.Router();

// ✅ Middleware: parse JSON, URL-encoded, XML, CORS, FormData
app.use(rapidfyJs.cors());
app.use(rapidfyJs.json());
app.use(rapidfyJs.urlencoded());
app.use(rapidfyJs.xml());
app.use(rapidfyJs.formData({
  uploadDir: path.join(__dirname, 'uploads'),
  maxFileSize: 10 * 1024 * 1024,
  maxFiles: 5,
}));

// ✅ Basic route
router.get('/', (req, res) => {
  res.json({ message: 'Welcome to RapidfyJS!' });
});

// ✅ Route POST + validation
router.post('/user', (req, res) => {
  const result = req.validate(['body'], {
    name: 'required|string',
    email: 'required|email',
  });

  if (result.error) {
    return res.status(400).json({
      status: 'error',
      message: 'Validation failed',
      errors: result.errors,
    });
  }

  res.json({
    status: 'success',
    data: result.validated,
  });
});

// ✅ File upload route
router.post('/upload', (req, res) => {
  res.json({
    status: 'success',
    message: 'File uploaded successfully',
    files: req.files,
  });
});

// ✅ Route for XML body
router.post('/xml', (req, res) => {
  res.json({
    message: 'Received XML data',
    data: req.body,
  });
});

// ✅ Mount router
app.use('/api/v1', router);

// ✅ Start server
app.listen(4000, () => console.log('🚀 RapidfyJS running on port 4000'));
  1. Initial the application
const app = rapidfyJs();
  1. Define your routes and middleware functions:
app.get('/', (req, res) => {
    res.send('Hello, World!');
});

app.listen(3000, () => {
    console.log('Server is running on port 3000');
});
  1. Start the server by running node app.js in your terminal.

Features

🧱 Middleware Usage

JSON Parser

app.use(rapidfyJs.json());

URL-encoded Parser

app.use(rapidfyJs.urlencoded());

XML Parser

app.use(rapidfyJs.xml());

CORS

app.use(rapidfyJs.cors());

FormData / File Upload

app.use(rapidfyJs.formData({
  uploadDir: path.join(__dirname, 'uploads'),
  maxFileSize: 10 * 1024 * 1024,
  maxFiles: 5,
  fieldSize: 10 * 1024,
  fields: 20,
}));

💾 Database Integration

RapidfyJS supports multiple databases via dbManager.

MongoDB

await rapidfyJs.connectDB('default', 'mongodb', {
  uri: 'mongodb://localhost:27017/mydb',
});
const db = rapidfyJs.mongoDB('mydb', 'default');
const users = await db.collection('users').find().toArray();

MySQL / MariaDB

await rapidfyJs.connectDB('main', 'mysql', {
  host: 'localhost',
  user: 'root',
  password: '',
  database: 'testdb',
});
const results = await rapidfyJs.query('SELECT * FROM users WHERE id = ?', [1], 'main');

PostgreSQL

await rapidfyJs.connectDB('pgdb', 'postgres', {
  host: 'localhost',
  user: 'postgres',
  password: '',
  database: 'testdb',
});
const results = await rapidfyJs.pgQuery('SELECT * FROM users', [], 'pgdb');

🧩 Request Helpers

req.query

Access query parameters:

router.get('/search', (req, res) => {
  res.json(req.query);
});

req.params

Dynamic route parameters:

router.get('/users/:id', (req, res) => {
  res.json({ userId: req.params.id });
});

req.bearerToken()

Extract Bearer token from Authorization header:

router.get('/auth', (req, res) => {
  res.json({ token: req.bearerToken() });
});

req.basicAuth()

Extract Basic Auth credentials:

router.get('/basic', (req, res) => {
  res.json(req.basicAuth());
});

req.validate(sources, rules)

Validate request data:

const result = req.validate(['body'], {
  name: 'required|string',
  email: 'required|email',
});

📤 Response Helpers

res.status(201).json({ message: 'Created' });

res.send('<h1>Hello</h1>');

res.json({ message: 'Hello' });

res.redirect('/login');

res.sendFile(path.join(__dirname, 'index.html'));

🧠 Error Handling

The framework includes a global error handler by default. If a handler throws an error, it will be caught and returned in the standard JSON format.

Example response:

{
  "status": "error",
  "code": 500,
  "message": "Something went wrong",
  "data": null,
  "metadata": null
}

🧺 Example XML Body

Request:

<order>
  <orderNumber>ORD-20251027001</orderNumber>
  <customer>
    <id>1001</id>
    <name>Rabi’ah Nawakaning</name>
  </customer>
  <items>
    <item>
      <productId>501</productId>
      <name>Notebook MSI Modern 15</name>
      <quantity>1</quantity>
      <price>25000</price>
    </item>
    <item>
      <productId>502</productId>
      <name>Wireless Mouse</name>
      <quantity>1</quantity>
      <price>600</price>
    </item>
  </items>
</order>

Response:

{
  "message": "Received XML data",
  "data": {
    "order": {
      "orderNumber": "ORD-20251027001",
      "customer": { "id": "1001", "name": "Rabi’ah Nawakaning" },
      "items": {
        "item": [
          { "productId": "501", "name": "Notebook MSI Modern 15", "quantity": "1", "price": "25000" },
          { "productId": "502", "name": "Wireless Mouse", "quantity": "1", "price": "600" }
        ]
      }
    }
  }
}

🏁 Run the Server

node app.js

Documentation

For detailed documentation and examples, please refer to the RapidfyJS Documentation.

Contributing

We welcome contributions from the community! If you have any ideas, bug reports, or feature requests, please submit them to our GitHub repository.

License

RapidfyJS is released under the MIT License.