nestjs-database | Skill Performance & Reviews | TopRankSkills

TopRank Skills

Home / Skills / tools / nestjs-database

nestjs-database

maintained by HoangNguyen0403

star 143 account_tree 48 verified_user MIT License
bolt View GitHub

name: NestJS Database description: Data access patterns, Scaling, Migrations, and ORM selection. metadata: labels: [nestjs, database, typeorm, prisma, mongodb] triggers: files: ['**/*.entity.ts', 'prisma/schema.prisma'] keywords: [TypeOrmModule, PrismaService, MongooseModule, Repository]

NestJS Database Standards

Priority: P0 (FOUNDATIONAL)

Database integration patterns and ORM standards for NestJS applications.

Selection Strategy

See references/persistence_strategy.md for database selection matrix and scaling patterns (Connection Pooling, Sharding).

Patterns

  • Repository Pattern: Isolate database logic.
    • TypeORM: Inject @InjectRepository(Entity).
    • Prisma: Create a comprehensive PrismaService.
  • Abstraction: Services should call Repositories, not raw SQL queries.

Configuration (TypeORM)

  • Async Loading: Always use TypeOrmModule.forRootAsync to load secrets from ConfigService.
  • Sync: Set synchronize: false in production; use migrations instead.

Migrations

  • Never use synchronize: true in production.
  • Execution: Run via init container or CD step.
  • Zero-Downtime: Use Expand-Contract pattern (Add -> Backfill -> Drop).
  • Seeding: Use factories for dev data; only static dicts for prod.

Best Practices

  1. Pagination: Mandatory. Use limit/offset or cursor-based pagination.
  2. Indexing: Define indexes in code (decorators/schema) for frequently filtered columns (where, order by).
  3. Transactions: Use QueryRunner (TypeORM) or $transaction (Prisma) for all multi-step mutations to ensure atomicity.

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!

Skill Details

GitHub Stars 143
GitHub Forks 48
Created Jan 2026
Last Updated il y a 8 mois
tools tools architecture patterns

Related Skills

dagger-design-proposals
chevron_right
nestjs-expert
chevron_right
docker-expert
chevron_right
prisma-expert
chevron_right
kafka-architecture
chevron_right

Build your own?

Join 12,000+ developers contributing to the Claude ecosystem.