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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dctrl/crudify

v1.1.0

Published

CRUD Generator

Downloads

1,314

Readme

Crudify

Effortless CRUD generator for Express.js projects. Boost your productivity by automating CRUD boilerplate code for your RESTful APIs.

npm version license


✨ Features

  • ⚡ Instant CRUD scaffolding for your Express.js project, Compatible with here
  • 🛠️ Generates controller, service, route and validation files
  • 📦 CLI interface for fast integration
  • ✅ Easily extendable and customizable
  • 🧪 Supports your existing folder structure

📦 Installation

npm install -g @dctrl/crudify

Or use it locally in your project:

npm install --save-dev @dctrl/crudify

🚀 Quick Start

Generate CRUD files for a User model:

crudify generate User --attributes=name:string,email:string

This will generate:

src/
├── application/
│   └── user
│       └── user.controller.js
│       └── user.route.js
│       └── user.service.js
│       └── user.validation.js

Generate Controller files for a User model:

crudify generate User -c

This will generate:

src/
├── application/
│   └── user
│       └── user.controller.js

Generate Service files for a User model:

crudify generate User -s

This will generate:

src/
├── application/
│   └── user
│       └── user.service.js

Generate Route files for a User model:

crudify generate User -r

This will generate:

src/
├── application/
│   └── user
│       └── user.route.js

Generate Validation files for a User model:

crudify generate User -v --attributes=email:string

This will generate:

src/
├── application/
│   └── user
│       └── user.validation.js

🛠️ Usage

crudify generate [name] [options]

Options

| Option | Description | |----------------------------------------------|---------------------------------------------------------------------------| | --controller, -c | Generate the controller file that handles HTTP requests and responses. | | --service, -s | Generate the service file that contains business logic or database access.| | --router, -r | Generate the route file to map HTTP endpoints to controller methods. | | --validation, -v | Generate the validation file to enforce input rules for request data. | | --attributes=<attributes>, -a=<attributes> | Comma-separated list of attributes for the entity |

Example

Generate only controller:

crudify generate User -c

Generate only service:

crudify generate User -s

Generate only route:

crudify generate User -r

Generate only validation:

crudify generate User -a --attributes=email:string

📁 Default Generated Structure

Each generated model will include:

  • Controller: Handles HTTP request and response. It receives the request from the route and calls the appropriate service logic
  • Service: Contains the core business logic such as database operations or data processing. It is reusable and keeps controllers clean.
  • Route: Maps incoming HTTP requests (e.g., GET, POST) to the appropriate controller functions.
  • Validation: Ensures that incoming request data (e.g., body, params) meets required rules before it reaches the controller.

✅ Example Output

Controller

const list = catchAsync(async (req, res) => {
  const { query } = req;
  const result = await __Name__Service.findAll(query);
  return new ApiResponse({
    messages: messages.COMMON.OK,
    data: result,
  }).send(res);
});

Service

const BaseService = require('../../../../@core/service/BaseService');
const { User } = require('../../../../database/models');

class UserService extends BaseService {}

module.exports = new UserService(User);

Router

/**
 * @swagger
 * /core/v1/users:
 *   post:
 *     summary: Create User
 *     tags: [User]
 *     security:
 *       - bearerAuth: [auth]
 *     description: Returns users data
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             $ref: '#/components/schemas/createOrUpdateUserRequest'
 *         application/x-www-form-urlencoded:
 *           schema:
 *             $ref: '#/components/schemas/createOrUpdateUserRequest'
 *     responses:
 *       '201':
 *         description: Successful Response
 *         content:
 *            application/json:
 *              schema:
 *                $ref: '#/components/schemas/userCreatedResponse'
 *       '401':
 *         description: Unauthorize response
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/unauthorizedResponse'
 *       '403':
 *         description: Forbidden
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/forbiddenResponse'
 *       '404':
 *         description: Not Found response
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/notFoundResponse'
 *       '422':
 *         description: Validation Error
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/badRequestFormResponse'
 */
router.post(
  '/',
  authCore({ menu: menuName, permission: 'create' }),
  validate(userValidation.createOrUpdate),
  userController.create,
);

Validation

const Joi = require('joi');

const createOrUpdate = {
  body: Joi.object().keys({ 
     name: Joi.string().required()
  }),
};

module.exports = {
  createOrUpdate,
};

🧩 Integration Notes

  • Compatible with Boilerplate Express here

📄 License

This project is licensed under the MIT License – see the LICENSE file for details.