| 00 | 00-execution-discipline.md | Think first, verify volatile facts (versions/APIs/model IDs) against docs, keep changes small, edit surgically, define success criteria, verify before claiming done |
| 01 | 01-folder-structure.md | src/{core,common,integrations,modules,events,commands} โ one place for each kind of code |
| 02 | 02-naming-conventions.md | camelCase vars, PascalCase classes, snake_case DB, kebab-case.ts files, SCREAMING_SNAKE env |
| 03 | 03-module-design.md | One module per bounded context; @Global() only for true app-wide infra |
| 04 | 04-code-quality.md | SOLID, constructor DI, pure utils, small functions, no any without a reason |
| 05 | 05-thinking-decision-trees.md | How to decide: where to put code, when to refactor, when to skip a test |
| 06 | 06-api-design.md | REST, plural nouns, verbs match semantics, URI versioning /v1/..., idempotency keys |
| 07 | 07-standard-responses.md | Single success returns a plain object; lists return { data, meta }; errors return { code, message, details?, traceId } |
| 08 | 08-pagination-filters-sorting.md | Cursor/keyset for sequential browsing, offset when page numbers/exact totals are real requirements; filter[field]=, sort=-createdAt; whitelist fields |
| 09 | 09-validation.md | class-validator DTOs + global ValidationPipe; Zod for env + runtime JSON parsing |
| 10 | 10-error-handling.md | Hybrid taxonomy: HTTP status + namespaced code + traceId; domain errors extend semantic Nest exceptions; one global filter with host.getType() + headersSent guards, logs via PinoLogger |
| 11 | 11-security.md | Security review routine: OWASP Top 10, transport/CORS, injection/SSRF, password hashing, rate limits, PII/audit, and links to auth/webhooks/uploads |
| 12 | 12-authentication-patterns.md | Session cookie (browsers) or Bearer JWT (mobile/server); hash session/refresh tokens at rest; rotate refresh; use revoked_before; cookie takes precedence and invalid cookies fail closed; auth errors use { code, message } |
| 13 | 13-database-design.md | snake_case, plural tables, FK <entity>_id, indexes on FKs + query paths, deleted_at, UUIDv7 or bigint |
| 14 | 14-database-orm-patterns.md | raw pg / TypeORM / Prisma / Drizzle โ side-by-side patterns |
| 15 | 15-migrations.md | Always forward-only in prod; no destructive changes without two-step rollout |
| 16 | 16-cascade-rules.md | ON DELETE CASCADE for owned data; RESTRICT for shared refs; SET NULL for optional |
| 17 | 17-pipelines-interceptors-guards.md | Order: Guard โ Interceptor (pre) โ Pipe โ Handler โ Interceptor (post) โ Filter |
| 18 | 18-events.md | EventEmitter2 for in-process; outbox pattern when crossing services or queues |
| 19 | 19-background-jobs.md | BullMQ default; idempotent handlers; retries with backoff; DLQ for poison messages |
| 20 | 20-configuration.md | ConfigModule global; Zod schema; fail fast on boot if env invalid |
| 21 | 21-logging.md | nestjs-pino, JSON in prod, redact secrets, correlation ID per request |
| 22 | 22-observability.md | OpenTelemetry traces + metrics; Langfuse/Helicone for LLM traces |
| 23 | 23-testing.md | Unit beside impl (*.spec.ts); e2e in test/; mock at boundaries; real DB for integration |
| 24 | 24-performance.md | Avoid N+1; size the pool; cache selectively; stream large payloads |
| 24a | 24a-caching-patterns.md | Cache deliberately; stable namespaced keys, TTL + invalidation, stampede protection; never the sole authority for auth/quota/billing |
| 25 | 25-documentation-swagger.md | @ApiTags / @ApiOperation / @ApiResponse; DTOs auto-schema via @ApiProperty |
| 26 | 26-ai-product-patterns.md | LLM gateway with provider abstraction, retry, fallback, timeout |
| 27 | 27-ai-streaming-sse.md | SSE endpoints; cancel-aware (abort upstream); heartbeat; typed event vocab; not resumable on reconnect |
| 28 | 28-ai-usage-metering-cost.md | Per-call token + cost rows; aggregate per user/org/model; enforce quotas |
| 29 | 29-code-review-checklist.md | PR review checklist across all rules above |
| 30 | 30-code-review-anti-patterns.md | Catalog of anti-patterns with good-vs-bad snippets |
| 31 | 31-rules-rationale-examples.md | Cross-cut rule + rationale + good/bad examples for quick reference |
| 32 | 32-modern-nestjs-stack.md | Decision checklist for modernizing/starting a NestJS service; bootstrap order, module-system checks; no frozen version matrix |
| 33 | 33-multi-tenancy-patterns.md | Server-derived tenant identity enforced across auth, guard, service, and repository layers; tests prove isolation |
| 34 | 34-health-shutdown.md | Liveness vs readiness; one shutdown coordinator; drain before close; worker processes drain separately |
| 35 | 35-source-of-truth-freshness.md | Durable invariants stay local; volatile APIs/versions/models verified against official docs and the repo |
| 36 | 36-webhooks.md | Verify signature on raw bytes (raw-body config + timingSafeEqual), dedupe on (provider, event_id), ack 2xx after enqueue (incl. unhandled types), re-fetch authoritative state for high-stakes events, resolve tenant from the verified payload |
| 37 | 37-file-uploads.md | Prefer presigned direct-to-bucket uploads (PUT for clients, POST policy for browsers); cap size/MIME at the boundary; sniff magic bytes; opaque tenant-prefixed storage keys; server-compute hash/size/mime; AV scan before exposure; rate-limit upload endpoints |
| 38 | 38-decorators-scopes-dynamic-modules.md | Param decorators only extract from request; default to singleton scope; dynamic modules for configurable infra; forwardRef is a smell |
| 39 | 39-exception-filters.md | One global filter shapes every error to { code, message, details?, traceId }; throw typed HttpException subclasses; never leak internals |
| 40 | 40-ddd-layered-architecture.md | Optional DDD layering in three tiers (classic layers โ layered feature modules โ hexagonal ports/adapters); dependencies point inward; domain stays framework-free; default six-bucket layout still wins for CRUD |