/nestjs:nestjs-datafrom NestJS
Guides on using @nestjs/drizzle and @nestjs/typeorm for database persistence in NestJS apps: registration, injection, migrations, transactions, and concurrent-safe writes.
Ships in NestJS. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Nest integrates the common ORMs; pick one per app and keep queries in services or repositories, not controllers.
| Package | Docs | |
|---|---|---|
| Drizzle (SQL-like, schema in TypeScript, no classes) | @nestjs/drizzle + drizzle-orm@rc (v1) | https://docs.nestjs.com/data/drizzle.md |
| TypeORM (entity classes, repositories) | @nestjs/typeorm + typeorm | https://docs.nestjs.com/data/typeorm.md |
| Prisma, MongoDB (Mongoose), Sequelize, MikroORM | /data/prisma, /data/mongodb, ... |
If the project already uses one, keep it.
DrizzleModule.forRoot({ drizzle, connection }) // drizzle(): your driver's, e.g. from 'drizzle-orm/libsql'
then @InjectDrizzle() private readonly db: LibSQLDatabase (type from the driver's entry point) in any provider; no forFeature(). The client closes on app.close()/shutdown hooks. Tables are plain objects: sqliteTable('notes', {...}), types from $inferSelect/$inferInsert. Migrations: drizzle-kit generate then drizzle-kit migrate, or migrate() from the driver's /migrator at startup.
TypeOrmModule.forRoot({ type, database, autoLoadEntities: true, synchronize: false }) at the root, TypeOrmModule.forFeature([Note]) in the feature module, @InjectRepository(Note) private readonly notes: Repository<Note>. synchronize: true is for throwaway development databases only: it can drop columns and data. Use migrations otherwise.
save() a whole entity to update it. TypeORM's save() inserts the row if it's gone, so a PATCH that loaded a note just before a concurrent DELETE puts it back. Update with repo.update({ id, userId }, changes) (or a query builder) and check result.affected; delete with repo.delete({ id, userId }). With Drizzle, db.update(notes).set(changes).where(and(eq(notes.id, id), eq(notes.userId, userId))).returning() and treat no row as 404.where: { id, userId: user.id }. A row that isn't the caller's is then simply not found.error.cause; SQLite SQLITE_CONSTRAINT_UNIQUE, PostgreSQL 23505) and answer 409; a lookup first lets two concurrent requests both pass.WHERE id > :after ORDER BY id LIMIT :limit + 1), not OFFSET: no COUNT(*), stable under inserts.db.transaction(async (tx) => ...), TypeORM dataSource.transaction(async (manager) => ...)).onDelete: 'cascade' on the foreign key (Drizzle references(() => users.id, { onDelete: 'cascade' }), TypeORM @ManyToOne(() => User, { onDelete: 'CASCADE' })), and for SQLite turn foreign keys on (PRAGMA foreign_keys = ON).:memory:. Create the parent directory if needed.bigint (int8) and numeric/decimal arrive as strings through pg, because JavaScript numbers can't hold them exactly. Convert where you need arithmetic, choose the column mode on purpose (Drizzle bigint({ mode: 'number' }) only when values stay below 2^53), and keep money as integer cents or numeric handled as strings.timestamptz in PostgreSQL; epoch milliseconds or ISO strings in SQLite, which has no date type) and convert at the edges.@nestjs/outbox).PrismaService extends PrismaClient provider, exported from one module, not a new PrismaClient() per service: each client has its own connection pool.better-sqlite3) don't, which hides races in tests that would appear on PostgreSQL.Recipes, all run on the released packages: schemas and relations, migrations at startup or as a release step, a repository with owner-scoped queries, cursor paging and unique violations mapped to 409, transactions, testing: references/data.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/nestjsNestJS, the TypeScript framework for Node.js backends. How to start a project non-interactively with the Nest CLI, the project layout and module system, where the current docs are, and the mistakes agents make in Nest apps that still pass their tests. Use when creating or extending a NestJS application./nestjs-authSign-in, sessions, bearer tokens, API keys and permissions in a NestJS application with the first-party @nestjs/authentication and @nestjs/authorization packages - timing-safe password checks, a global guard with @Public(), policies with @Can(), and what to do when a task fixes the JWT secret or token format. Use when adding or changing authentication or authorization in a NestJS application./nestjs-featureAdd or change HTTP endpoints in a NestJS application - modules, controllers and services, request validation (Zod or another Standard Schema library with @Body({ schema }), or class-validator DTOs), status codes, error response bodies, request IDs, versioning and Server-Sent Events. Use when adding or changing endpoints in a NestJS application./nestjs-productionProduction setup for a NestJS application with first-party packages - configuration and env validation (@nestjs/config), structured logs, observability with NestJS Observe (@nestjs/observe), health and readiness checks (@nestjs/terminus), rate limiting (@nestjs/throttler), OpenAPI (@nestjs/swagger), graceful shutdown and deployment behind a load balancer. Use when preparing a NestJS application for production, or adding any of these to one./nestjs-testingUnit, service and end-to-end tests for a NestJS application with @nestjs/testing - Test.createTestingModule, mocking and overriding providers and global guards, Supertest against the real app, signing test users in, SSE, test databases, Vitest in ESM projects (Jest in CommonJS ones). Use when writing, running or fixing tests in a NestJS application.2 plugins ship this exact skill · first indexed Nov 20, 2026
npx claudepluginhub nestjs/agent-skills --plugin nestjsOther plugins' skills for the same job