Rules
nestjs-doctor ships with 52 built-in rules across five categories.
Categories
| Category | Rules | Focus |
|---|---|---|
| Security | 12 | Secrets, injection, CSRF, stack traces |
| Correctness | 20 | Missing decorators, duplicate routes, async issues |
| Architecture | 10 | Layer violations, circular deps, DI patterns |
| Performance | 7 | Sync I/O, blocking constructors, dead code |
| Schema | 3 | Primary 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.