// type-safe CRUD for NestJS

Ship NestJS CRUD APIs in minutes.

A generic CRUD controller & service, one query language across Mongoose, Prisma & TypeORM, built-in soft-delete & auditing, and a CLI that scaffolds production-ready apps.

$npm install -g @nest-extended/cli
MIT licensed
NestJS 11+
TypeScript-first
one query · _find()
service._find({
  status: { $in: ['active'] },
  $sort: { createdAt: -1 },
  $limit: 20,
});
Mongoose
model
  .find({ status: { $in: ['active'] } })
  .sort({ createdAt: -1 })
  .limit(20);
Prisma
prisma.cat.findMany({
  where: { status: { in: ['active'] } },
  orderBy: { createdAt: 'desc' },
  take: 20,
});
TypeORM
repo.find({
  where: { status: In(['active']) },
  order: { createdAt: 'DESC' },
  take: 20,
});
Works with the stack you already use
Features

Everything you need for CRUD APIs

Stop hand-writing the same controllers and services. nest-extended gives you the proven patterns, batteries included.

Generic CRUD

Extend NestController and NestService for instant find, get, create, patch and delete endpoints — pagination included.

Unified query language

FeathersJS-style operators ($in, $gte, $or, $iLike) that behave identically on Mongoose, Prisma and TypeORM.

Soft delete & auditing

Automatic createdBy / updatedBy / deletedBy tracking and non-destructive deletes you can restore.

Multi-database

MongoDB, PostgreSQL, MySQL and SQLite through Mongoose, Prisma or TypeORM — swap the ORM, keep your code.

JWT auth, generated

Opt in to an auth + users module scaffolded with @nestjs/jwt and bcrypt, plus request-scoped user context.

Smart exceptions

Database-aware error mapping (e.g. Prisma P2002 → friendly 409) and a null-to-404 response interceptor.

Type-safe generics

End-to-end TypeScript generics across controllers, services and DTOs — your models flow through everything.

CLI scaffolding

nest-cli generates apps, CRUD resources and auth with one command, wiring modules and best practices for you.

Database-agnostic

One service. Any database.

Pick Mongoose, Prisma or TypeORM — the service you write and the way you query are identical.

cats.service.ts
// cats.service.ts
import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { NestService } from '@nest-extended/mongoose';
import { Cat, CatDocument } from './schemas/cat.schema';

@Injectable()
export class CatsService extends NestService<Cat, CatDocument> {
  constructor(@InjectModel(Cat.name) model: Model<CatDocument>) {
    super(model);
  }
}
And query with the same syntax

A single FeathersJS-style query object drives pagination, filtering, sorting and relation loading — translated to the right Mongoose, Prisma or TypeORM call under the hood.

query.ts
// One query language — works the same on every adapter
const results = await service._find({
  status: { $in: ['active', 'pending'] },
  price: { $gte: 10, $lte: 100 },
  name: { $iLike: 'phone' },
  $or: [{ category: 'audio' }, { brand: 'acme' }],
  $sort: { createdAt: -1 },
  $limit: 20,
  $include: { reviews: true },
});
Vanilla NestJS vs nest-extended

Less boilerplate. More shipping.

The same production features — without writing (and maintaining) them by hand on every project.

Vanilla NestJS
nest-extended

CRUD endpoints

Hand-written per resource

Generated by NestController

Pagination & sorting

Manual, per query

Built into every find

Filtering / query language

Custom per endpoint

One operator set everywhere

Soft delete & auditing

Wire it up yourself

Automatic createdBy / deletedBy

Switch database / ORM

Rewrite your services

Same API, swap the adapter

DB error handling

Manual try / catch

DB-aware exception filter

JWT auth & users

Build from scratch

Scaffolded on demand

Project scaffolding

Copy / paste boilerplate

nest-cli generators

Scaffolding CLI

From zero to a running API in one command

nest-cli g app scaffolds a production-ready NestJS project with sensible defaults — then add resources as you go.

NestJS app wired for your database & ORM

Soft-delete config, exception filter & null→404 interceptor

Optional JWT auth + users module

CRUD resources via nest-cli g service

zsh — nest-cli
$ 

Start building in minutes

Add nest-extended to an existing NestJS app, or scaffold a fresh one with the CLI.

$npm install @nest-extended/cli