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

ready-crud

v1.0.3

Published

Generate Express CRUD controllers and routes automatically from your Mongoose model schema.

Readme

🧱 ready-crud

npm Node License Platform

A lightweight and easy-to-use CLI tool to auto-generate Express.js CRUD controllers and routes from your Mongoose schema files — with configurable paths, minimal setup, and no external dependencies.


🚀 Installation

You can use ready-crud directly with npx (recommended):

npx ready-crud init

Or install it globally if you want to use it across multiple projects:

npm install -g ready-crud

⚙️ Initialization (One-Time Setup)

Before generating files, you need to initialize the package so it knows where to place your controllers and routes.

Run the init command in your project root:

npx ready-crud init

This creates a configuration file named:

readycrud.config.json

Example Config:

{
  "controllerPath": "./src/controllers",
  "routePath": "./src/routes"
}

After initialization, you’ll see a confirmation message:

✅ readycrud.config.json created successfully!
📁 Controller Path: ./src/controllers
📁 Route Path: ./src/routes

You can edit these paths anytime to match your project’s folder structure.


🛠️ Generate CRUD Files

Once the config is set, generate controller and route files by running:

npx ready-crud ./src/models/client.model.js

✅ This will:

  • Read the client.model.js file

  • Detect the model name (client)

  • Create:

    • client.controller.js in your configured controllers path
    • client.route.js in your configured routes path

📁 Example Project Structure

Before running:

src/
  models/
    client.model.js

After running:

src/
  models/
    client.model.js
  controllers/
    client.controller.js
  routes/
    client.route.js

💡 Example Generated Code

🧩 Controller (client.controller.js)

import { Client } from "../startup/models.js";

export const clientController = {
  async create(req, res) {
    try {
      const data = await Client.create(req.body);
      res.status(201).json({ success: true, message: "Client created successfully", data });
    } catch (error) {
      res.status(500).json({ success: false, message: error.message });
    }
  },

  async update(req, res) {
    try {
      const data = await Client.findByIdAndUpdate(req.params.id, req.body, { new: true });
      res.json({ success: true, message: "Client updated successfully", data });
    } catch (error) {
      res.status(500).json({ success: false, message: error.message });
    }
  },

  async delete(req, res) {
    try {
      await Client.findByIdAndDelete(req.params.id);
      res.json({ success: true, message: "Client deleted successfully" });
    } catch (error) {
      res.status(500).json({ success: false, message: error.message });
    }
  },

  async getById(req, res) {
    try {
      const data = await Client.findById(req.params.id);
      res.json({ success: true, data });
    } catch (error) {
      res.status(500).json({ success: false, message: error.message });
    }
  },

  async getAll(req, res) {
    try {
      const data = await Client.find();
      res.json({ success: true, data });
    } catch (error) {
      res.status(500).json({ success: false, message: error.message });
    }
  },
};

🛣️ Route (client.route.js)

import { Router } from "express";
import { clientController } from "../controllers/client.controller.js";

const route = Router();

route.post("/", clientController.create);
route.patch("/:id", clientController.update);
route.delete("/:id", clientController.delete);
route.get("/:id", clientController.getById);
route.get("/", clientController.getAll);

export default route;

🧰 Commands Summary

| Command | Description | | ---------------------------------------------- | -------------------------------------------------- | | npx ready-crud init | Create config file with controller and route paths | | npx ready-crud ./src/models/example.model.js | Generate controller and route for a given schema | | npm install -g ready-crud | (Optional) Install globally for CLI access |


🧠 Troubleshooting

❌ No Config Found

If you run the generator without initializing:

❌ No readycrud.config.json found.
👉 Run: npx ready-crud init

⚠️ Schema File Not Found

If the path you provide doesn’t exist:

❌ Schema file not found at: ./src/models/client.model.js

💬 Example Workflow

# Step 1: Initialize (only once per project)
npx ready-crud init

# Step 2: Create a new model
touch src/models/task.model.js

# Step 3: Generate controller and route
npx ready-crud ./src/models/task.model.js

✅ Result:

✅ Controller created at: ./src/controllers/task.controller.js
✅ Route created at: ./src/routes/task.route.js

⚡ Features

  • 🧩 Auto-generates Express route & controller boilerplate
  • ⚙️ Customizable output paths via config file
  • 🪶 Zero dependencies (works out-of-the-box)
  • 💾 Safe file creation (won’t overwrite existing files)
  • 📦 Works with ES Modules (import/export)

🧱 Use Cases

  • Quickly scaffold new CRUD modules for Express projects
  • Maintain consistent structure across multiple backends
  • Speed up MVP and admin panel development
  • Teach junior developers clean, modular structure

🧑‍💻 Author

Abdullah – Next Level Software Building developer utilities and automation tools 🚀

📧 Contact: LinkedInSupport: Buy me a coffee


🧾 License

MIT © 2025 Abdullah — Free to use, modify, and distribute.