Skip to content

Shaligula/nest-crud-generator

Repository files navigation

CRUD Generator CLI for NestJS & Mongoose

A CLI tool to automatically generate CRUD (Create, Read, Update, Delete) endpoints for Mongoose models in NestJS applications.

Supports:

  • ✅ REST API generation
  • ✅ Swagger/OpenAPI documentation (optional)
  • ✅ Automatic DTOs with validation
  • ✅ Pagination & Filtering

Install

npm install -g @shaligula/nest-crud-generator

Usage

nest-crud-generator generate ./src/models/book.model.ts

This will create:

  • book.module.ts
  • book.controller.ts
  • book.service.ts
  • book.mapper.ts
  • /dto

Options

Option Description Default
-o, --output Custom output directory ./src/
--no-swagger Disable Swagger decorators (for dto may use mapped-types package) false
-f, --force Overwrite existing files false

Example with options:

nest-crud-generator generate ./src/models/book.model.ts -o ./src/books --no-swagger -f

Example

See example