← スキル一覧に戻る

nestjs-database
by HoangNguyen0403
nestjs-databaseは、other分野における実用的なスキルです。複雑な課題への対応力を強化し、業務効率と成果の質を改善します。
⭐ 111🍴 40📅 2026年1月23日
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.
- TypeORM: Inject
- Abstraction: Services should call Repositories, not raw SQL queries.
Configuration (TypeORM)
- Async Loading: Always use
TypeOrmModule.forRootAsyncto load secrets fromConfigService. - Sync: Set
synchronize: falsein production; use migrations instead.
Migrations
- Never use
synchronize: truein 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
- Pagination: Mandatory. Use limit/offset or cursor-based pagination.
- Indexing: Define indexes in code (decorators/schema) for frequently filtered columns (
where,order by). - Transactions: Use
QueryRunner(TypeORM) or$transaction(Prisma) for all multi-step mutations to ensure atomicity.
スコア
総合スコア
85/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
✓人気
GitHub Stars 100以上
+5
✓最近の活動
3ヶ月以内に更新
+5
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
レビュー
💬
レビュー機能は近日公開予定です

