Skip to main content
NestJS CRUD is a microframework for building RESTful services with automatic CRUD endpoint generation, advanced query parsing, and TypeORM integration.

Why NestJS CRUD?

Building CRUD endpoints for every entity in your application is repetitive and time-consuming. NestJS CRUD eliminates this boilerplate by automatically generating fully-featured REST endpoints with a single decorator.
@Crud({
  model: { type: Company }
})
@Controller('companies')
export class CompaniesController {
  constructor(public service: CompaniesService) {}
}
With just this code, you get all standard CRUD endpoints automatically generated.

Key features

Zero boilerplate

Generate complete CRUD APIs with a single @Crud() decorator. No need to write repetitive endpoint handlers.

Advanced querying

Built-in support for filtering, pagination, sorting, relations, nested relations, and field selection through query parameters.

TypeORM integration

Seamless integration with TypeORM. Extend TypeOrmCrudService and get instant database operations.

Type-safe validation

Automatic request validation using class-validator and class-transformer decorators on your entities.

Swagger documentation

Auto-generated OpenAPI documentation for all CRUD endpoints. Works seamlessly with @nestjs/swagger.

Highly customizable

Override individual endpoints, customize query behavior, configure route options, and add authentication per route.

What you get automatically

When you apply the @Crud() decorator to a controller, you automatically get these endpoints:
EndpointMethodDescription
/GETGet many entities with filtering, pagination, sorting
/:idGETGet a single entity by ID
/POSTCreate a new entity
/:idPATCHUpdate an existing entity
/:idPUTReplace an existing entity
/:idDELETEDelete an entity

Query capabilities

Every GET endpoint comes with powerful query parsing out of the box:
# Filter companies by name
GET /companies?filter=name||$cont||Tech

# Multiple filters
GET /companies?filter=name||$cont||Tech&filter=domain||$ends||.com

Packages

The NestJS CRUD ecosystem consists of three main packages:

@nestjsx/crud

The core package providing the @Crud() decorator, route generation, validation, and helper decorators.
npm install @nestjsx/crud class-transformer class-validator

@nestjsx/crud-typeorm

TypeORM integration providing TypeOrmCrudService with ready-to-use database operations.
npm install @nestjsx/crud-typeorm @nestjs/typeorm typeorm

@nestjsx/crud-request

Request builder/parser for frontend applications. Build type-safe API queries in your client code.
npm install @nestjsx/crud-request
Start with the Installation guide to set up NestJS CRUD in your project, then follow the Quickstart to build your first CRUD API.

Database support

Through TypeORM integration, NestJS CRUD supports:
  • PostgreSQL
  • MySQL / MariaDB
  • SQLite
  • Microsoft SQL Server
  • Oracle
  • CockroachDB
  • And all other TypeORM-supported databases

Next steps

Installation

Install and configure NestJS CRUD in your project

Quickstart

Build your first CRUD API in minutes