Back to list
HoangNguyen0403

nestjs-database

by HoangNguyen0403

A collection of Agent Skills Standard and Best Practice for Programming Languages, Frameworks that help our AI Agent follow best practies on frameworks and programming laguages

111🍴 40📅 Jan 23, 2026

SKILL.md


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.

Score

Total Score

85/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

+5
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon