What is nestjs-doctor?
nestjs-doctor is a diagnostic CLI tool that scans NestJS codebases and produces a health score with categorized diagnostics. It analyzes the TypeScript AST to detect anti-patterns across five categories:
- Security — hardcoded secrets, eval usage, CSRF disabled, exposed stack traces
- Correctness — missing decorators, duplicate routes, async without await
- Architecture — ORM in controllers, circular module dependencies, manual instantiation
- Performance — sync I/O, blocking constructors, unused providers
- Schema — missing primary keys, timestamps, cascade rules
npx nestjs-doctor@latest .

How It Works
The pipeline reads your source files, builds a module dependency graph, runs 43 rules against the AST, and produces a weighted health score. See the pipeline overview for the full architecture.
HTML Report
Generate an interactive HTML report:
npx nestjs-doctor@latest . --report
Generates a self-contained HTML file with five tabs: summary, diagnostics, interactive module graph, schema ER diagram, and rule lab. Click any module to inspect its providers, controllers, imports, and exports. Circular dependencies are highlighted in red with concrete fix suggestions.
