
rev-dep v3.0.0
Dependency analysis and optimization toolkit for modern JavaScript and TypeScript codebases. Enforce dependency graph hygiene and remove unused code with a very fast CLI.
Rev-dep
Capabilities • Installation • Documentation • Exploratory Toolkit • Newsletter
Dependency analysis and optimization toolkit for modern JavaScript and TypeScript codebases.
Enforce dependency graph hygiene and remove unused code with a very fast CLI.
About 📣
As codebases scale, maintaining a mental map of dependencies becomes impossible. Rev-dep is a high-speed static analysis tool designed to enforce architecture integrity and dependency hygiene across large-scale JS/TS projects.
Think of Rev-dep as a high-speed linter for your dependency graph.
Consolidate fragmented, sequential checks from multiple slow tools into a single, high-performance engine. Rev-dep executes a full suite of governance checks - including circularity, orphans, module boundaries and more, in one parallelized pass. Implemented in Go to bypass the performance bottlenecks of Node-based analysis, it can audit a 500k+ LoC project in approximately 150ms. See the performance comparison
Automated Codebase Governance
Rev-dep moves beyond passive scanning to active enforcement, answering (and failing CI for) the hard questions:
- Architecture Integrity: "Is my 'Domain A' illegally importing from 'Domain B'?".
- Dead Code & Bloat: "Are these files unreachable, or are these
node_modulesunused?". - Refactoring Safety: "Which entry points actually use this utility, and are there circular chains?".
- Workspace Hygiene: "Are my imports consistent and are all dependencies declared?".
Rev-dep serves as a high-speed gatekeeper for your CI, ensuring your dependency graph remains lean and your architecture stays intact as you iterate.
Why Rev-dep? 🤔
🏗️ First-class monorepo support
Designed for modern workspaces (pnpm, yarn, npm). Rev-dep natively resolves package.json exports/imports maps, TypeScript aliases and traces dependencies across package boundaries.
🛡️ Config-Based Codebase Governance
Move beyond passive scanning. Use the configuration engine to enforce Module Boundaries and Import Conventions. Execute a full suite of hygiene checks (circularity, orphans, unused modules and more) in a single, parallelized pass that serves as a high-speed gatekeeper for your CI.
🔍 Exploratory Toolkit
CLI toolkit that helps debug issues with dependencies between files. Understand transitive relation between files and fix issues.
⚡ Built for Speed and CI Efficiency
Implemented in Go to eliminate the performance tax of Node-based analysis. By processing files in parallel, Rev-dep offers 17x-90x faster execution than alternatives, significantly reducing CI costs and developer wait-states.
Rev-dep can audit a 500k+ LoC project in around 150ms. See the performance comparison
Capabilities 🚀
Governance and maintenance (config-based) 🛡️
Use rev-dep config run to execute multiple checks in one pass for all packages.
Available checks:
moduleBoundaries- enforce architecture boundaries between modules.importConventions- enforce import style conventions (offers autofix).unusedExportsDetection- detect exports that are never used (offers autofix).orphanFilesDetection- detect dead/orphan files (offers autofix).unusedNodeModulesDetection- detect dependencies declared but not used.missingNodeModulesDetection- detect imports missing from package json.unresolvedImportsDetection- detect unresolved import requests.circularImportsDetection- detect circular imports.duplicatedCodeDetection- detect copy-pasted code (repeated blocks and JSX elements).devDepsUsageOnProdDetection- detect dev dependencies used in production code.restrictedImportsDetection- block importing denied files/modules from selected entry points.restrictedImportersDetection- whitelist which entry points may transitively reach a set of files/modules.restrictedDirectImportersDetection- constrain which files may directly import a set of files/modules (non-transitive).
Exploratory analysis (CLI-based) 🔍
Use CLI commands for ad-hoc dependency exploration:
entry-points- discover project entry points.files- list dependency tree files for a given entry point.resolve- trace dependency paths between files (who imports this file).imported-by- list direct importers of a file.circular- list circular dependency chains.duplicated-code- find copy-pasted code blocks and JSX elements.node-modules- inspectused,unused,missing, andinstallednode modules.lines-of-code- count effective LOC.unresolved- list imports that could not be resolved, grouped by file.list-cwd-files- list all source code files in CWDdebug- inspect what rev-dep parses, resolves, and discovers internally.
Installation 📦
Full documentation: rev-dep.com/docs/intro
Install locally to set up project check scripts
yarn add -D rev-dep
npm install -D rev-dep
pnpm add -D rev-dep
Create config file for a quick start:
npx rev-dep config init
Install globally to use as a CLI tool:
yarn global add rev-dep
npm install -g rev-dep
pnpm global add rev-dep
Step-by-step integration guides
Follow the guide that matches your project to get from zero to a working setup:
- Monorepo integration guide - for
pnpm/yarn/npmworkspaces. - Single workspace integration guide - for single-package projects.
Quick Examples 💡
A few instant-use examples to get a feel for the tool:
# Detect circular imports/dependencies
rev-dep circular
# Find copy-pasted code
rev-dep duplicated-code
# Detect unused node modules
rev-dep node-modules unused
# List all entry points in the project
rev-dep entry-points
# Check which files an entry point imports
rev-dep files --entry-point src/index.ts
# Find every entry point that depends on a file
rev-dep resolve --file src/utils/math.ts
# Resolve dependency path between files
rev-dep resolve --file src/utils/math.ts --entry-point src/index.ts
Config-Based Checks 🛡️
Rev-dep provides a configuration system for orchestrating project checks. The config approach is designed for speed and is the preferred way of implementing project checks because it can execute all checks in a single pass, significantly faster than multiple running individual commands separately.
Available checks are: