-
Notifications
You must be signed in to change notification settings - Fork 0
Home
NestJS gives you modules, DI, and a clean request pipeline. What it doesn't give you is the eight CRUD endpoints every REST API writes from scratch: list, paginate, filter, sort, join, nested-join, soft-delete, recover. So you keep writing the same query-parse + DB-translate glue for every resource.
nestjs-crud writes those eight endpoints from one @Crud() decorator. It handles query parsing (?filter=, ?sort=, ?join=, ?page=), validation, pagination, soft-delete, and Swagger docs. Plug in your entity and a service that extends one of the ORM adapters (TypeORM, Drizzle, MikroORM, or Prisma). Need custom behavior on one route? Drop @Override() on your handler and keep the other seven generated.
Forked from @nestjsx/crud. Modernized dependencies, regular releases, same API on v1.0.x (drop-in for existing @nestjsx/crud consumers), and an opt-in v2.x when you want the cleanup. Upgrade path: Versions.
nestjs-crud ships as a Yarn workspaces monorepo. Four adapters, plus the core framework, the request builder, and a shared util:
-
@nestjs-crud/core —
@Crud()decorator, global config, validation, helper decorators (Controllers) -
@nestjs-crud/request —
RequestQueryBuilderfor the frontend,RequestQueryParserfor the backend (Requests) -
@nestjs-crud/typeorm —
TypeOrmCrudServicebase class (ServiceTypeorm) -
@nestjs-crud/drizzle —
DrizzleCrudServicebase class (ServiceDrizzle) -
@nestjs-crud/mikro-orm —
MikroOrmCrudServicebase class (ServiceMikroOrm) -
@nestjs-crud/prisma —
PrismaCrudServicebase class, new in v2.0.0 (ServicePrisma) - @nestjs-crud/util — internal shared helpers (you won't install this directly)
-
Controllers —
@Crud()options, overrides, auth, validation - Services — base service contract shared across adapters
- Requests · Query syntax — how parsed requests and frontend queries work
-
Swagger — setup and full
@Crud({ swagger: {...} })customization - Caching · Logging · Relation load strategy
- v1 → v2 — breaking changes across all adapters
- v2.0 → v2.1 — Prisma v7 consumer upgrade (driver adapter required)
git clone https://github.com/kodjunkie/nestjs-crud
cd nestjs-crud
docker compose up -d
yarn install
yarn build
yarn testdocker compose brings up Postgres on port 5455, MySQL on 3316, and Redis on 6399 for integration runs.
yarn db:prepare:typeorm:postgres
yarn start:typeormOpen http://localhost:3000/docs for Swagger. The source lives at examples/typeorm-demo/ — a standalone NestJS app you can copy from.