Rules

nestjs-doctor ships with 52 built-in rules across five categories.

Categories

CategoryRulesFocus
Security12Secrets, injection, CSRF, stack traces
Correctness20Missing decorators, duplicate routes, async issues
Architecture10Layer violations, circular deps, DI patterns
Performance7Sync I/O, blocking constructors, dead code
Schema3Primary keys, timestamps, cascade rules

Rule scopes

Rules have one of three scopes:

  • File-scoped: runs once per source file. The context carries one SourceFile.
  • Project-scoped: runs once for the project. The context carries the module graph and the provider map.
  • Schema-scoped: runs once against the schema graph. The context carries entities extracted from Prisma, TypeORM, Drizzle, or MikroORM.

Writing your own

See Custom rules for the rule interface, the two contexts, and a worked example.