Skip to main content

What is Config-Based Governance?

Rev-dep provides a powerful configuration system that allows you to define and enforce architecture rules across your entire codebase. Instead of running individual CLI commands separately, you can configure all your checks in a single file and execute them in one parallelized pass.
Think of Rev-dep config as a high-speed linter for your dependency graph.
The config-based approach moves beyond passive scanning to active enforcement, answering critical questions like:
  • Architecture Integrity: “Is my ‘Domain A’ illegally importing from ‘Domain B’?”
  • Dead Code & Bloat: “Are these files unreachable, or are these node_modules unused?”
  • Refactoring Safety: “Which entry points actually use this utility?”
  • Workspace Hygiene: “Are my imports consistent and are all dependencies declared?”

Why Use Configuration?

The configuration approach provides significant advantages over running individual CLI commands:

Single-Pass Execution

Massive Performance Gains

Execute a full suite of governance checks in one parallelized pass instead of running multiple sequential commands.
Performance Benefits:
  • Single Dependency Tree Build: Builds one comprehensive dependency tree for all rules
  • Parallel Rule Execution: Processes multiple rules simultaneously
  • Parallel Check Execution: Runs all enabled checks within each rule in parallel
  • Optimized File Discovery: Discovers files once and reuses across all checks
Rev-dep can audit a 500k+ LoC project in around 500ms using the config approach.

Comprehensive Governance

Instead of fragmented, sequential checks from multiple tools, consolidate everything into a single high-performance engine:
{
  "configVersion": "1.6",
  "rules": [
    {
      "path": ".",
      "circularImportsDetection": { "enabled": true },
      "unusedExportsDetection": { "enabled": true },
      "moduleBoundaries": [...],
      "importConventions": [...]
    }
  ]
}

CI/CD Integration

The config-based approach is designed for continuous integration:
  • Fail Fast: Exit with error code if any check fails
  • Consistent Rules: Same rules enforced across all team members
  • Version Controlled: Config file lives in your repo
  • Autofix Support: Automatically fix issues in CI or pre-commit hooks

Available Checks

Rev-dep supports the following checks in configuration:
Enforce architecture boundaries between modules. Prevent unauthorized cross-domain imports.
Enforce import style conventions (relative vs absolute). Supports autofix.
Detect exports that are never used. Supports autofix.
Detect dead/orphan files unreachable from entry points. Supports autofix.
Detect dependencies declared but not used.
Detect imports missing from package.json.
Detect unresolved import requests.
Detect circular import chains.
Detect dev dependencies used in production code.
Block importing denied files/modules from selected entry points.

Getting Started

1

Initialize Configuration

Create a default configuration file in your project:
npx rev-dep config init
This creates .rev-dep.config.jsonc with sensible defaults based on your project structure.
2

Customize Rules

Open .rev-dep.config.jsonc and adjust the rules to match your project needs:
  • Enable/disable specific checks
  • Configure module boundaries for your architecture
  • Set up import conventions for consistency
  • Define entry points for orphan file detection
3

Run Checks

Execute all configured checks:
npx rev-dep config run
This runs all enabled checks in a single pass and reports violations.
4

Apply Fixes

For checks that support autofix, apply fixes automatically:
npx rev-dep config run --fix

Config File Behavior

Monorepo Support

When running rev-dep config init: At monorepo root:
  • Creates a root rule for workspace-level boundaries
  • Creates individual rules for each discovered workspace package
  • Each package gets its own tailored checks
In a monorepo package directory:
  • Creates a single rule with path: "." for the current package only
  • Optimized for package-level development
In a regular project:
  • Creates a single rule with path: "." for the entire project
  • Includes all standard checks

Configuration Files

Rev-dep looks for configuration in the following order:
  1. .rev-dep.config.jsonc
  2. .rev-dep.config.json
  3. rev-dep.config.jsonc
  4. rev-dep.config.json
Only one config file should exist in a directory. Multiple config files will cause an error.

Next Steps

Config File Structure

Learn about the complete configuration schema

Define Rules

Understand how to structure rules for your codebase

Configure Checks

Deep dive into each available check type

CLI Reference

Explore config command options

Build docs developers (and LLMs) love