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

@theutkarshdev/rapid-api-kit

v1.2.0

Published

Zero-config REST API generator with file uploads. Give your MongoDB creds + schema, get full CRUD endpoints with Swagger docs and Vercel Blob file uploads instantly.

Readme

rapid-api-kit 🚀

Zero-config REST API generator. Give your MongoDB creds + schema, get full CRUD endpoints with Swagger docs instantly. Now with file upload support via Vercel Blob Storage!

Built for frontend students who need quick backend APIs to practice with — no backend knowledge needed!


What You Get

For each resource you define, you automatically get:

| Method | Endpoint | Description | | -------- | --------------------- | -------------------------------------- | | GET | /api/{resource} | List all (paginated, filtered, sorted) | | GET | /api/{resource}/:id | Get one by ID | | POST | /api/{resource} | Create new | | PUT | /api/{resource}/:id | Full update (replace) | | PATCH | /api/{resource}/:id | Partial update | | DELETE | /api/{resource}/:id | Delete by ID |

Plus:

  • Swagger UI at /api/docs — interactive API playground
  • Pagination?page=1&limit=10
  • Sorting?sort=-createdAt or ?sort=name
  • Filtering?name=John&age_gte=18
  • Search?search=keyword across configured fields
  • Field selection?fields=name,email
  • Validation — Mongoose schema validation with clear error messages
  • File Uploadstype: "File" in your schema → automatic file upload via Vercel Blob Storage
  • CORS enabled by default
  • TimestampscreatedAt and updatedAt added automatically

Installation

npm install @theutkarshdev/rapid-api-kit

Quick Start

Create a file (e.g., server.js):

const { rapidAPI } = require("@theutkarshdev/rapid-api-kit");

rapidAPI({
  mongoURI: "mongodb://localhost:27017/mydb",
  port: 5000,
  resources: [
    {
      name: "users",
      schema: {
        name: { type: String, required: true },
        email: { type: String, required: true, unique: true },
        age: { type: Number },
        role: { type: String, enum: ["admin", "user"], default: "user" },
      },
      searchBy: ["name", "email"], // Enable text search on these fields
      filterBy: ["role", "age"], // Only these fields appear as filters in Swagger
    },
    {
      name: "posts",
      schema: {
        title: { type: String, required: true },
        body: { type: String },
        author: { type: String },
        published: { type: Boolean, default: false },
      },
      searchBy: ["title", "body", "author"], // Full-text search fields
      filterBy: ["author", "published"], // Filterable in Swagger UI
    },
  ],
});

Run it:

node server.js

That's it! Open http://localhost:5000/api/docs to see your Swagger UI.


Configuration

| Option | Type | Default | Description | | ------------- | ------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- | | mongoURI | string | required | MongoDB connection string | | port | number | 5000 | Server port | | resources | array | required | Array of resource definitions | | apiPrefix | string | "/api" | Base path for all endpoints | | logging | boolean | true | Enable Morgan request logging | | cors | object | {} | CORS options (passed to cors package) | | swaggerInfo | object | {} | Custom Swagger title, description, version | | blobToken | string | — | Vercel Blob read-write token. Required when any resource uses type: "File" fields | | searchBy | array | [] | Fields for ?search= text search (case-insensitive) | | filterBy | array | [] | Fields shown as query filters in Swagger UI. Enum/boolean → dropdown, others → text input. If omitted, all fields are filterable. |

Resource Definition

{
  name: "products",       // Collection name (lowercase, plural recommended)
  schema: {               // Mongoose schema definition
    name:     { type: String, required: true },
    price:    { type: Number, min: 0 },
    category: { type: String, enum: ["electronics", "books", "clothing"] },
    inStock:  { type: Boolean, default: true },
    tags:     [String],
  },
  searchBy: ["name"],                 // Fields for ?search=keyword (case-insensitive)
  filterBy: ["category", "inStock"],  // Fields shown as query filters in Swagger UI
}

Supported Schema Types

| Type | Example | | --------- | ----------------------------------------- | | String | { type: String, required: true } | | Number | { type: Number, min: 0, max: 100 } | | Boolean | { type: Boolean, default: false } | | Date | { type: Date } | | Array | [String] or { type: [String] } | | Enum | { type: String, enum: ["a", "b", "c"] } |


File Uploads (Vercel Blob Storage)

rapid-api-kit supports file uploads out of the box. Just use type: "File" in your schema — files are automatically uploaded to Vercel Blob Storage and the public URL is stored in MongoDB.

Setup

  1. Create a Vercel Blob Store — Go to your Vercel dashboard → Storage → Create a Blob Store
  2. Get your read-write token — Copy the BLOB_READ_WRITE_TOKEN from the store settings
  3. Pass it as blobToken in your config

Example

const { rapidAPI } = require("@theutkarshdev/rapid-api-kit");

rapidAPI({
  mongoURI: "mongodb://localhost:27017/mydb",
  port: 5000,
  blobToken: "vercel_blob_rw_xxxxxxxxxxxx", // Your Vercel Blob read-write token
  resources: [
    {
      name: "users",
      schema: {
        name: { type: String, required: true },
        email: { type: String, required: true },
        avatar: "File", // Simple — any file, no restrictions
        resume: {
          type: "File",
          required: true,
          maxSize: 5, // Max 5 MB
          accept: ".pdf,.doc,.docx", // Only these file types
        },
      },
    },
  ],
});

File Field Options

| Option | Type | Default | Description | | ---------- | ------- | ------- | ------------------------------------------------------------------------------------------------- | | type | string | — | Must be "File" | | required | boolean | false | Whether the file is required on create | | maxSize | number | 10 | Maximum file size in MB | | accept | string | — | Allowed types — same syntax as HTML <input accept="">. Examples: .pdf, image/*, image/png |

How It Works

  • POST requests with file fields use multipart/form-data instead of JSON
  • Files are uploaded to Vercel Blob and the returned public URL is saved in MongoDB as a string
  • PUT / PATCH — uploading a new file automatically deletes the old blob from storage
  • DELETE — deleting a document automatically deletes all associated blobs
  • File path format in blob storage: {resource}/{documentId}/{field}-{timestamp}.{ext}

Uploading Files from Frontend

// Using FormData to upload files
const formData = new FormData();
formData.append("name", "John Doe");
formData.append("email", "[email protected]");
formData.append("avatar", fileInput.files[0]); // File input element
formData.append("resume", resumeInput.files[0]);

const res = await fetch("http://localhost:5000/api/users", {
  method: "POST",
  body: formData, // No Content-Type header — browser sets it automatically
});

const { data } = await res.json();
console.log(data.avatar); // → "https://xxxxxxxxx.public.blob.vercel-storage.com/users/abc123/avatar-1234567890.png"
console.log(data.resume); // → "https://xxxxxxxxx.public.blob.vercel-storage.com/users/abc123/resume-1234567890.pdf"

Tip: You can use the blobToken from an environment variable (e.g., process.env.BLOB_READ_WRITE_TOKEN) to keep it out of your code.


Query Examples

Pagination

GET /api/users?page=2&limit=5

Sorting

GET /api/users?sort=name          # ascending
GET /api/users?sort=-createdAt    # descending (newest first)

Search

GET /api/users?search=john        # searches across searchBy fields (case-insensitive)

Filtering

GET /api/users?role=admin
GET /api/users?age_gte=18&age_lte=30
GET /api/users?name=/john/         # regex search (case-insensitive)

Filter operators:

  • field_gt — greater than
  • field_gte — greater than or equal
  • field_lt — less than
  • field_lte — less than or equal
  • field_ne — not equal

Field Selection

GET /api/users?fields=name,email

API Response Format

Success (list)

{
  "success": true,
  "data": [...],
  "pagination": {
    "total": 50,
    "page": 1,
    "limit": 10,
    "totalPages": 5,
    "hasNext": true,
    "hasPrev": false
  }
}

Success (single)

{
  "success": true,
  "data": { "_id": "...", "name": "John", ... }
}

Error

{
  "success": false,
  "error": "Validation failed",
  "details": [{ "field": "email", "message": "Path `email` is required." }]
}

Using with Frontend Frameworks

React (fetch)

// List all users
const res = await fetch("http://localhost:5000/api/users");
const { data } = await res.json();

// Create user
await fetch("http://localhost:5000/api/users", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ name: "John", email: "[email protected]" }),
});

Angular (HttpClient)

this.http.get("http://localhost:5000/api/users").subscribe((res) => {
  this.users = res.data;
});

Next.js (API route / Server Component)

const res = await fetch("http://localhost:5000/api/users", {
  cache: "no-store",
});
const { data } = await res.json();

Use with MongoDB Atlas (Free Cloud DB)

  1. Go to MongoDB Atlas and create a free cluster
  2. Get your connection string
  3. Use it:
rapidAPI({
  mongoURI: "mongodb+srv://username:[email protected]/mydb",
  resources: [...]
});

License

MIT