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.
- 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.
- 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: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:moduleBoundaries
moduleBoundaries
Enforce architecture boundaries between modules. Prevent unauthorized cross-domain imports.
importConventions
importConventions
Enforce import style conventions (relative vs absolute). Supports autofix.
unusedExportsDetection
unusedExportsDetection
Detect exports that are never used. Supports autofix.
orphanFilesDetection
orphanFilesDetection
Detect dead/orphan files unreachable from entry points. Supports autofix.
unusedNodeModulesDetection
unusedNodeModulesDetection
Detect dependencies declared but not used.
missingNodeModulesDetection
missingNodeModulesDetection
Detect imports missing from package.json.
unresolvedImportsDetection
unresolvedImportsDetection
Detect unresolved import requests.
circularImportsDetection
circularImportsDetection
Detect circular import chains.
devDepsUsageOnProdDetection
devDepsUsageOnProdDetection
Detect dev dependencies used in production code.
restrictedImportsDetection
restrictedImportsDetection
Block importing denied files/modules from selected entry points.
Getting Started
Initialize Configuration
Create a default configuration file in your project:This creates
.rev-dep.config.jsonc with sensible defaults based on your project structure.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
Run Checks
Execute all configured checks:This runs all enabled checks in a single pass and reports violations.
Config File Behavior
Monorepo Support
When runningrev-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
- Creates a single rule with
path: "."for the current package only - Optimized for package-level development
- 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:.rev-dep.config.jsonc.rev-dep.config.jsonrev-dep.config.jsoncrev-dep.config.json
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
