nestjs-doctorGitHub

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:

  1. Explicit path via --config flag
  2. nestjs-doctor.config.json in the project root
  3. .nestjs-doctor.json in the project root
  4. "nestjs-doctor" key in package.json
  5. Built-in defaults

The first match takes precedence. See Config Loading for implementation details.

Options

KeyTypeDescription
includestring[]Glob patterns to scan (default: ["**/*.ts"])
excludestring[]Glob patterns to skip (additive with defaults)
minScorenumberMinimum passing score (0-100)
ignore.rulesstring[]Rule IDs to suppress
ignore.filesstring[]Glob patterns for files whose diagnostics are hidden
rulesRecord<string, RuleOverride | boolean>Enable/disable individual rules, or override severity
categoriesRecord<string, boolean>Enable/disable entire categories
customRulesDirstringPath 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

  • exclude patterns are additive to defaults. Your patterns are appended, so safety exclusions like node_modules are never accidentally removed.
  • include patterns replace defaults entirely. If you set include, 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:

SeverityWeightCategoryMultiplier
error3.0security1.5x
warning1.5correctness1.3x
info0.5architecture1.0x
performance0.8x
ScoreLabel
90-100Excellent
75-89Good
50-74Fair
25-49Poor
0-24Critical

See Scoring for the full formula and calibration details.