Configuration
Configuration is optional. nestjs-doctor applies reasonable defaults when no configuration file is present.
Config File
Create nestjs-doctor.config.json in your project root:
{
"minScore": 75,
"ignore": {
"rules": ["architecture/no-orm-in-services"],
"files": ["src/generated/**"]
},
"rules": {
"architecture/no-barrel-export-internals": false
},
"categories": {
"performance": false
}
}
Or use a "nestjs-doctor" key in package.json:
{
"nestjs-doctor": {
"minScore": 75,
"rules": {
"architecture/no-barrel-export-internals": false
}
}
}
Config Resolution
The config loader searches for configuration in this order:
- Explicit path via
--configflag nestjs-doctor.config.jsonin the project root.nestjs-doctor.jsonin the project root"nestjs-doctor"key inpackage.json- Built-in defaults
The first match takes precedence. See Config Loading for implementation details.
Options
| Key | Type | Description |
|---|---|---|
include | string[] | Glob patterns to scan (default: ["**/*.ts"]) |
exclude | string[] | Glob patterns to skip (additive with defaults) |
minScore | number | Minimum passing score (0-100) |
ignore.rules | string[] | Rule IDs to suppress |
ignore.files | string[] | Glob patterns for files whose diagnostics are hidden |
rules | Record<string, RuleOverride | boolean> | Enable/disable individual rules, or override severity |
categories | Record<string, boolean> | Enable/disable entire categories |
customRulesDir | string | Path to a directory of custom .ts rule files |
Rules can be set to false to disable them, or configured with an object to override severity:
{
"rules": {
"architecture/no-barrel-export-internals": false,
"security/no-hardcoded-secret": { "enabled": true, "severity": "error" }
}
}
Default Excludes
These patterns are always excluded (your exclude config is additive):
node_modules/**,dist/**,build/**,coverage/****/*.spec.ts,**/*.test.ts,**/*.e2e-spec.ts,**/*.e2e-test.ts**/*.d.ts**/test/**,**/tests/**,**/__tests__/****/__mocks__/**,**/__fixtures__/**,**/mock/**,**/mocks/**,**/*.mock.ts**/seeder/**,**/seeders/**,**/*.seed.ts,**/*.seeder.ts
Include vs Exclude Behavior
excludepatterns are additive to defaults. Your patterns are appended, so safety exclusions likenode_modulesare never accidentally removed.includepatterns replace defaults entirely. If you setinclude, only those patterns are scanned.
Monorepo Support
Monorepo mode is auto-detected from nest-cli.json:
{
"monorepo": true,
"projects": {
"api": { "root": "apps/api" },
"admin": { "root": "apps/admin" },
"shared": { "root": "libs/shared" }
}
}
Each sub-project is scanned independently. Per-project config files are supported — place a nestjs-doctor.config.json inside a sub-project's root to override the root config for that project.
The report shows a combined score plus a per-project breakdown.
Scoring
Scores are weighted by severity and category, normalized by file count:
| Severity | Weight | Category | Multiplier | |
|---|---|---|---|---|
| error | 3.0 | security | 1.5x | |
| warning | 1.5 | correctness | 1.3x | |
| info | 0.5 | architecture | 1.0x | |
| performance | 0.8x |
| Score | Label |
|---|---|
| 90-100 | Excellent |
| 75-89 | Good |
| 50-74 | Fair |
| 25-49 | Poor |
| 0-24 | Critical |
See Scoring for the full formula and calibration details.