Skip to content

kodjunkie/nestjs-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

210 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

nestjs-crud

RESTful APIs for NestJS — from a single @Crud() decorator

npm version CI License: MIT


Eight RESTful endpoints for any NestJS controller: list, paginate, filter, sort, join, nested-join, soft-delete, recover. Zero handlers to write.

Features

A NestJS service and controller using @Crud()

  • CRUD controllers and services you extend, not scaffolds you own
  • DB and service agnostic. Base classes per adapter
  • Query parsing: filters, pagination, sort, relations, nested relations, cache
  • Pluggable cache: Redis, ioredis, Prisma Accelerate, or bring your own
  • Framework-agnostic query builder for the frontend
  • Body, query, and path-param validation included
  • Override any generated handler with @Override()
  • Small config. Per-controller or global defaults
  • Swagger docs auto-wired (optional peer)

Quick start

npm install @nestjs-crud/core @nestjs-crud/typeorm
@Crud({
  model: { type: User },
  query: { limit: 25, maxLimit: 100, join: { profile: { eager: true } } },
})
@Controller('users')
export class UsersController {
  constructor(public service: UsersService) {}
}

You get GET /users, GET /users/:id, POST /users, POST /users/bulk, PATCH /users/:id, PUT /users/:id, DELETE /users/:id, and POST /users/:id/recover. Each route ships with query parsing, validation, and pagination built in. Swagger appears automatically when @nestjs/swagger is installed.

Adapters

Adapter Package Docs
TypeORM @nestjs-crud/typeorm ServiceTypeorm
Drizzle @nestjs-crud/drizzle ServiceDrizzle
MikroORM @nestjs-crud/mikro-orm ServiceMikroOrm
Prisma @nestjs-crud/prisma ServicePrisma

Plus @nestjs-crud/core (decorator + framework, see Controllers) and @nestjs-crud/request (frontend query builder, see Requests).

Versions

  • v2.x (current): released on npm as @nestjs-crud/*@2.x, active development on master. Adds the Prisma adapter, a shared QueryTranslator core, tighter types, and real-DB integration tests.
  • v1.0.x (maintenance): drop-in replacement for @nestjsx/crud. Same API, modernized dependencies, security patches, runs on NestJS 11. Moving off the base library? Install @nestjs-crud/*@1.0.x and you're done, no code changes. Browse the v1.0.2 tag or branch. Backports land there only if needed.

Moving off @nestjsx/crud? Step first to @nestjs-crud/*@1.0.x (same API, zero code changes), then decide whether to take the breaking-change upgrade to @nestjs-crud/*@2.x via the v1 → v2 guide. Already on v2.0? The v2.0 → v2.1 guide covers the Prisma-v7 consumer migration.

Documentation

Full docs live on the Wiki. Main sections:

Skills

Three agent skills ship alongside the library:

Skill Scope
nestjs-crud Current v2.x: setup, adapters, @Crud() options, Swagger customization, transactions, common issues
nestjs-crud-v1 Legacy v1.0.x behavior reference
nestjs-crud-migration v1 → v2 upgrade playbook: audit greps, error-to-fix mapping
# all three
npx skills add kodjunkie/nestjs-crud

# one at a time
npx skills add kodjunkie/nestjs-crud -s nestjs-crud
npx skills add kodjunkie/nestjs-crud -s nestjs-crud-migration

Credits

Built on the work of Michael Yali and the @nestjsx/crud contributors. Fork point: upstream 5.0.0-alpha.3. See NOTICE.md for the full fork history.

License

MIT. The upstream author's 2018-Present copyright and the fork maintainer's 2026-Present copyright both apply. Keep both notices intact if you fork.