Type-safe CRUD for Drizzle ORM in NestJS.
Configure the connection once in AppModule. Every entity gets the full CRUD surface, type-safe, dialect-aware, and ready to extend.
- 1Configure once in AppModule
DrizzleCrudModule.forRoot({ dialect: 'postgresql', connectionString: process.env.DATABASE_URL, schema, }); - 2A service is an empty subclass
export class UsersService extends SqlBaseCrudService<User> {} - 3Bind it to its table
DrizzleCrudModule.forFeature([ { service: UsersService, table: users }, ]);
That's it. UsersService now has find, create, update, delete, soft delete, restore, bulk ops, filtering, pagination, and full-text search.
What you get
Compatible with
Latest releases
Declare a hasMany relation and findAll loads the whole page's children in one extra query, never one per row. options.select now takes dotted paths like region.code, and the package ships an MCP server so any AI agent can read its docs.
ForeignKeyViolationException and EntityInUseException are exported again. A create or update pointing at a missing parent row returns 400, and a delete blocked by dependent rows returns 409, instead of a raw 500.
The package homepage now points at crud.viliha.com, and the READMEs link the docs, npm, and GitHub. No runtime change, and the foreign-key regression it carried is fixed in 3.2.2.
Dialect quirks, error mapping, and query correctness are ongoing work, given away for free. If this package saves you time, sponsoring is what keeps it maintained.