Show HN: Rev-dep – 20x faster knip.dev alternative build in Go

2026-02-26T21:02:03.000Z·★ 97·16 min read
[Capabilities](https://github.com/jayu/rev-dep#capabilities-)•[Installation](https://github.com/jayu/rev-dep#installation-)•[Exploratory Toolkit](https://github.com/jayu/rev-dep#exploratory-toolkit-)•...

CapabilitiesInstallationExploratory Toolkit•...


CapabilitiesInstallationExploratory ToolkitCLI Reference Image 3: rev-dep versionImage 4: rev-dep licenseImage 5: rev-dep PRs welcome About 📣 ------------ [](https://github.com/jayu/rev-dep#about-) 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 500ms. 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'?". 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? 🤔 ------------------- [](https://github.com/jayu/rev-dep#why-rev-dep-) ### 🏗️ First-class monorepo support [](https://github.com/jayu/rev-dep#%EF%B8%8F-first-class-monorepo-support) Designed for modern workspaces (pnpm, yarn, npm). Rev-dep natively resolves package.jsonexports/imports maps, TypeScript aliases and traces dependencies across package boundaries. 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 [](https://github.com/jayu/rev-dep#-exploratory-toolkit) ### ⚡ Built for Speed and CI Efficiency [](https://github.com/jayu/rev-dep#-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 10x-200x faster execution than alternatives, significantly reducing CI costs and developer wait-states. > Rev-dep can audit a 500k+ LoC project in around 500ms.See the performance comparison Capabilities 🚀 --------------- [](https://github.com/jayu/rev-dep#capabilities-) ### Governance and maintenance (config-based) 🛡️ [](https://github.com/jayu/rev-dep#governance-and-maintenance-config-based-%EF%B8%8F) 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. * restrictedImportsDetection - block importing denied files/modules from selected entry points. ### Exploratory analysis (CLI-based) 🔍 [](https://github.com/jayu/rev-dep#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. * node-modules - inspect used, unused, missing, and installed node modules. Installation 📦 ------------------- [](https://github.com/jayu/rev-dep#installation-) Install locally to set up project check scripts `` yarn add -D rev-dep npm install -D rev-dep pnpm add -D rev-dep 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 **Quick Examples 💡** --------------------- [](https://github.com/jayu/rev-dep#quick-examples-) A few instant-use examples to get a feel for the tool: # Detect unused node modules rev-dep node-modules unused # Detect circular imports/dependencies rev-dep circular # 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 🛡️ ----------------------- [](https://github.com/jayu/rev-dep#config-based-checks-%EF%B8%8F) 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: * 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. * restrictedImportsDetection - block importing denied files/modules from selected entry points. Checks are grouped in rules. You can have multiple rules, eg. for each monorepo package. Initialize a configuration file in your project: # Create a default configuration file rev-dep config init Behavior of rev-dep config init: * Monorepo root: Running rev-dep config init at the workspace root creates a root rule and a rule for each discovered workspace package. Run all configured checks (dry run, not fixes applied yet): # Execute all rules and checks defined in the config rev-dep config run Fix all fixable checks: # Fix checks configured with autofix rev-dep config run --fix ### Configuration Structure [](https://github.com/jayu/rev-dep#configuration-structure) #### Comprehensive Config Example [](https://github.com/jayu/rev-dep#comprehensive-config-example) Here's a comprehensive example showing all available properties: ### Available Properties [](https://github.com/jayu/rev-dep#available-properties) #### Root Level Properties [](https://github.com/jayu/rev-dep#root-level-properties) * **configVersion** (required): Configuration version string * **$schema** (optional): JSON schema reference for validation * **conditionNames** (optional): Array of condition names for exports resolution * **ignoreFiles** (optional): Global file patterns to ignore across all rules. Git ignored files are skipped by default. * **rules** (required): Array of rule objects #### Rule Properties [](https://github.com/jayu/rev-dep#rule-properties) Each rule can contain the following properties: * **followMonorepoPackages** (optional): Enable monorepo package resolution (default: true) * **moduleBoundaries** (optional): Array of module boundary rules * **circularImportsDetection** (optional): Circular import detection configuration * **orphanFilesDetection** (optional): Orphan files detection configuration * **unusedNodeModulesDetection** (optional): Unused node modules detection configuration * **missingNodeModulesDetection** (optional): Missing node modules detection configuration * **unusedExportsDetection** (optional): Unused exports detection configuration * **unresolvedImportsDetection** (optional): Unresolved imports detection configuration * **devDepsUsageOnProdDetection** (optional): Restricted dev dependencies usage detection configuration * **restrictedImportsDetection** (optional): Restrict importing denied files/modules from selected entry points * **importConventions** (optional): Array of import convention rules #### Module Boundary Properties [](https://github.com/jayu/rev-dep#module-boundary-properties) * **name** (required): Name of the boundary * **pattern** (required): Glob pattern for files in this boundary * **allow** (optional): Array of allowed import patterns * **deny** (optional): Array of denied import patterns (overrides allow) #### Import Convention Properties [](https://github.com/jayu/rev-dep#import-convention-properties) * **rule** (required): Type of the rule, currently only relative-internal-absolute-external * **autofix** (optional): Whether to automatically fix import convention violations (default: false) * **domains** (required): Array of domain definitions. Can be a string (glob pattern) or an object with: * **enabled** (optional): Set to false to skip checks for this domain (default: true) #### Detection Options Properties [](https://github.com/jayu/rev-dep#detection-options-properties) **CircularImportsDetection:** * **enabled** (required): Enable/disable circular import detection * **ignoreTypeImports** (optional): Exclude type-only imports when building graph (default: false) **OrphanFilesDetection:** * **enabled** (required): Enable/disable orphan files detection * **validEntryPoints** (optional): Array of valid entry point patterns (eg. ["src/index.ts", "src/main.ts"]) * **ignoreTypeImports** (optional): Exclude type-only imports when building graph (default: false) * **graphExclude** (optional): File patterns to exclude from graph analysis * **autofix** (optional): Delete detected orphan files automatically when running rev-dep config run --fix (default: false) **UnusedNodeModulesDetection:** * **enabled** (required): Enable/disable unused modules detection * **includeModules** (optional): Module patterns to include in analysis * **excludeModules** (optional): Module patterns to exclude from analysis * **pkgJsonFieldsWithBinaries** (optional): Package.json fields containing binary references (eg. lint-staged). Performs plain-text lookup * **filesWithBinaries** (optional): File patterns to search for binary usage. Performs plain-text lookup * **filesWithModules** (optional): Non JS/TS file patterns to search for module imports (eg. shell scripts). Performs plain-text lookup * **outputType** (optional): Output format - "list", "groupByModule", "groupByFile" **MissingNodeModulesDetection:** * **enabled** (required): Enable/disable missing modules detection * **includeModules** (optional): Module patterns to include in analysis * **excludeModules** (optional): Module patterns to exclude from analysis * **outputType** (optional): Output format - "list", "groupByModule", "groupByFile", "groupByModuleFilesCount" **UnusedExportsDetection:** * **enabled** (required): Enable/disable unused exports detection * **validEntryPoints** (optional): Glob patterns for files whose exports are never reported as unused (eg. ["index.ts", "src/public-api.ts"]) * **ignoreTypeExports** (optional): Skip export type / export interface from analysis (default: false) * **graphExclude** (optional): File patterns to exclude from unused exports analysis **UnresolvedImportsDetection:** * **enabled** (required): Enable/disable unresolved imports detection * **ignoreFiles** (optional): File path globs; all unresolved imports from matching files are suppressed * **ignoreImports** (optional): Import requests to suppress globally in unresolved results **DevDepsUsageOnProd:** * **enabled** (required): Enable/disable restricted dev dependencies usage detection * **prodEntryPoints** (optional): Production entry point patterns to trace dependencies from (eg. ["src/pages/**/*.tsx", "src/main.tsx"]) * **ignoreTypeImports** (optional): Exclude type-only imports from graph traversal and module matching (default: false) **RestrictedImportsDetection:** * **enabled** (required): Enable/disable restricted imports detection * **entryPoints** (required when enabled): Entry point patterns used to build reachable dependency graph * **denyFiles** (optional): Denied file path patterns (eg. ["**/*.tsx"]) * **denyModules** (optional): Denied module patterns (eg. ["react", "react-*"]) * **ignoreMatches** (optional): File/module patterns to suppress from restricted import results * **ignoreTypeImports** (optional): Exclude type-only imports from traversal (default: false) ### Performance Benefits [](https://github.com/jayu/rev-dep#performance-benefits) The configuration approach provides significant performance advantages: * **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 **Exploratory Toolkit 🔧** -------------------------- [](https://github.com/jayu/rev-dep#exploratory-toolkit-) ### **How to identify where a file is used in the project** [](https://github.com/jayu/rev-dep#how-to-identify-where-a-file-is-used-in-the-project) rev-dep resolve --file path/to/file.ts You'll see all entry points that implicitly require that file, along with resolution paths. ### **How to check if a file is used** [](https://github.com/jayu/rev-dep#how-to-check-if-a-file-is-used) rev-dep resolve --file path/to/file.ts --compact-summary Shows how many entry points indirectly depend on the file. ### **How to identify dead files** [](https://github.com/jayu/rev-dep#how-to-identify-dead-files) rev-dep entry-points Exclude framework entry points if needed using --result-exclude. rev-dep entry-points --result-exclude "pages/**","scripts/**","**/*.test.*" ### **How to list all files imported by an entry point** [](https://github.com/jayu/rev-dep#how-to-list-all-files-imported-by-an-entry-point) rev-dep files --entry-point path/to/file.ts Useful for identifying heavy components or unintended dependencies. ### **How to reduce unnecessary imports for an entry point** [](https://github.com/jayu/rev-dep#how-to-reduce-unnecessary-imports-for-an-entry-point) 1. List all files imported: rev-dep files --entry-point path/to/entry.ts 2. Identify suspicious files. 3. Trace why they are included: rev-dep resolve --file path/to/suspect --entry-points path/to/entry.ts --all ### **How to detect circular dependencies** [](https://github.com/jayu/rev-dep#how-to-detect-circular-dependencies) rev-dep circular ### **How to find unused node modules** [](https://github.com/jayu/rev-dep#how-to-find-unused-node-modules) rev-dep node-modules unused ### **How to find missing node modules** [](https://github.com/jayu/rev-dep#how-to-find-missing-node-modules) rev-dep node-modules missing ### **How to check node_modules space usage** [](https://github.com/jayu/rev-dep#how-to-check-node_modules-space-usage) rev-dep node-modules dirs-size Working with Monorepo 🏗️ ------------------------- [](https://github.com/jayu/rev-dep#working-with-monorepo-%EF%B8%8F) ### followMonorepoPackages Flag [](https://github.com/jayu/rev-dep#followmonorepopackages-flag) # Enable monorepo package resolution rev-dep circular --follow-monorepo-packages rev-dep resolve --file src/utils.ts --follow-monorepo-packages rev-dep entry-points --follow-monorepo-packages When enabled, rev-dep will: * **Detect workspace packages** automatically by scanning for monorepo configuration * **Resolve imports between packages** within the workspace * **Follow package.json exports** for proper module resolution ### Exports Map Support [](https://github.com/jayu/rev-dep#exports-map-support) The exports map support includes: * **Conditional exports** using conditions like node, import, default, and custom conditions * **Wildcard patterns** for flexible subpath mapping * **Sugar syntax** for simple main export definitions * **Nested conditions** for complex resolution scenarios ### Condition Names Flag [](https://github.com/jayu/rev-dep#condition-names-flag) To control which conditional exports are resolved, use the --condition-names flag. This allows you to specify the priority of conditions when resolving package exports: # Resolve exports for different environments rev-dep circular --condition-names=node,import,default rev-dep resolve --file src/utils.ts --condition-names=import,node rev-dep entry-points --condition-names=default,node,import The conditions are processed in the order specified, with the first matching condition being used. Common conditions include: * node - Node.js environment * import - ES modules * require - CommonJS * default - Fallback condition * Custom conditions specific to your project or build tools Example package.json with exports: { "name": "@myorg/utils", "exports": { ".": { "import": "./dist/index.mjs", "require": "./dist/index.js", "default": "./dist/index.js" }, "./helpers": "./dist/helpers.js", "./types/*": "./dist/types/*.d.ts" } } ### How It Works [](https://github.com/jayu/rev-dep#how-it-works) 1. **Monorepo Detection**: When followMonorepoPackages is enabled, rev-dep scans for workspace configuration (pnpm-workspace.yaml, package.json workspaces, etc.) 2. **Package Resolution**: Imports to workspace packages are resolved using the package's exports configuration, falling back to main/module fields when exports are not defined 3. **Dependency Validation**: The tool validates that cross-package imports are only allowed when the target package is listed in the consumer's dependencies or devDependencies 4. **Path Resolution**: All paths are resolved relative to their respective package roots, ensuring accurate dependency tracking across the entire monorepo Performance comparison ⚡ ------------------------ [](https://github.com/jayu/rev-dep#performance-comparison-) Rev-dep can perform multiple checks on 500k+ LoC monorepo with several sub-packages in around 500ms. It outperforms Madge, dpdm, dependency-cruiser, skott, knip, depcheck and other similar tools. Here is a performance comparison of specific tasks between rev-dep and alternatives: | Task | Execution Time [ms] | Alternative | Alternative Time [ms] | Slower Than Rev-dep | | --- | --- | --- | --- | --- | | Find circular dependencies | 289 | dpdm-fast | 7061 | 24x | | Find unused exports | 303 | knip | 6606 | 22x | | Find unused files | 277 | knip | 6596 | 23x | | Find unused node modules | 287 | knip | 6572 | 22x | | Find missing node modules | 270 | knip | 6568 | 24x | | List all files imported by an entry point | 229 | madge | 4467 | 20x | | Discover entry points | 323 | madge | 67000 | 207x | | Resolve dependency path between files | 228 | please suggest | | | | Check node_modules disk usage | 1619 | please suggest | | | > Benchmark run on WSL Linux Debian Intel(R) Core(TM) i9-14900KF CPU @ 2.80GHz ### Circular check performance comparison [](https://github.com/jayu/rev-dep#circular-check-performance-comparison) Benchmark performed on MacBook Pro with Apple M1 chip, 16GB of RAM and 256GB of Storage. Power save mode off. Benchmark performed with hyperfine using 8 runs per test and 4 warm up runs, taking mean time values as a result. If single run was taking more than 10s, only 1 run was performed. rev-dep circular check is **12 times** faster than the fastest alternative❗ | Tool | Version | Command to Run Circular Check | Time | | --- | --- | --- | --- | | 🥇 [rev-dep](https://github.com/jayu/rev-dep) | 2.0.0 | rev-dep circular | 397 ms | | [skott](https://github.com/antoine-coulon/skott) | 0.35.6 | node script using skott findCircularDependencies function | 29575 ms | | [madge](https://github.com/pahen/madge) | 8.0.0 | madge --circular --extensions js,ts,jsx,tsx . | 69328 ms | | [circular-dependency-scanner](https://github.com/emosheeep/circular-dependency-scanner) | 2.3.0 | ds - out of memory error | n/a | rev-dep config run When devDepsUsageOnProdDetection is enabled in your config, rev-dep will: 1. Trace dependency graphs from your specified production entry points 2. Identify all files reachable from those entry points 3. Check if any imported modules are listed in devDependencies in package.json 4. Report violations showing which dev dependencies are used where **Example Output:** lodash (dev dependency) - src/components/Button.tsx (from entry point: src/pages/index.tsx) - src/utils/helpers.ts (from entry point: src/pages/index.tsx) eslint (dev dependency) - src/config/eslint-config.js (from entry point: src/server.ts) **Important Notes:** * Type-only imports (e.g., import type { ReactNode } from 'react') are ignored when ignoreTypeImports is enabled * Only dependencies from devDependencies in package.json are flagged * Production dependencies from dependencies are allowed * Helps prevent runtime failures in production builds CLI reference 📖 ---------------- [](https://github.com/jayu/rev-dep#cli-reference-) ### rev-dep circular [](https://github.com/jayu/rev-dep#rev-dep-circular) Detect circular dependencies in your project #### Synopsis [](https://github.com/jayu/rev-dep#synopsis) rev-dep circular [flags] #### Examples [](https://github.com/jayu/rev-dep#examples) rev-dep circular --ignore-types-imports #### Options [](https://github.com/jayu/rev-dep#options) --condition-names strings List of conditions for package.json imports resolution (e.g. node, imports, default) --follow-monorepo-packages strings Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass package names -h, --help help for circular -t, --ignore-type-imports Exclude type imports from the analysis --package-json string Path to package.json (default: ./package.json) --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) -v, --verbose Show warnings and verbose output ### rev-dep config [](https://github.com/jayu/rev-dep#rev-dep-config) Create and execute rev-dep configuration files #### Synopsis [](https://github.com/jayu/rev-dep#synopsis-1) Commands for creating and executing rev-dep configuration files. #### Options [](https://github.com/jayu/rev-dep#options-1) -h, --help help for config ### rev-dep config run [](https://github.com/jayu/rev-dep#rev-dep-config-run) Execute all checks defined in (.)rev-dep.config.json(c) #### Synopsis [](https://github.com/jayu/rev-dep#synopsis-2) Process (.)rev-dep.config.json(c) and execute all enabled checks (circular imports, orphan files, module boundaries, import conventions, node modules, unused exports, unresolved imports, restricted imports and restricted dev deps usage) per rule. rev-dep config run [flags] #### Options [](https://github.com/jayu/rev-dep#options-2) --condition-names strings List of conditions for package.json imports resolution (e.g. node, imports, default) --follow-monorepo-packages strings Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass package names -h, --help help for run --package-json string Path to package.json (default: ./package.json) --rules strings Subset of rules to run (comma-separated list of rule paths) --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) -v, --verbose Show warnings and verbose output ### rev-dep config init [](https://github.com/jayu/rev-dep#rev-dep-config-init) Initialize a new rev-dep.config.json file #### Synopsis [](https://github.com/jayu/rev-dep#synopsis-3) rev-dep config init [flags] #### Options [](https://github.com/jayu/rev-dep#options-3) -h, --help help for init ### rev-dep entry-points [](https://github.com/jayu/rev-dep#rev-dep-entry-points) Discover and list all entry points in the project #### Synopsis [](https://github.com/jayu/rev-dep#synopsis-4) Analyzes the project structure to identify all potential entry points. Useful for understanding your application's architecture and dependencies. rev-dep entry-points [flags] #### Examples [](https://github.com/jayu/rev-dep#examples-1) rev-dep entry-points --print-deps-count #### Options [](https://github.com/jayu/rev-dep#options-4) --condition-names strings List of conditions for package.json imports resolution (e.g. node, imports, default) -n, --count Only display the number of entry points found --follow-monorepo-packages strings Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass package names --graph-exclude strings Exclude files matching these glob patterns from analysis -h, --help help for entry-points -t, --ignore-type-imports Exclude type imports from the analysis --package-json string Path to package.json (default: ./package.json) --print-deps-count Show the number of dependencies for each entry point --result-exclude strings Exclude files matching these glob patterns from results --result-include strings Only include files matching these glob patterns in results --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) -v, --verbose Show warnings and verbose output `` ### rev-dep

↗ Original source
← Previous: Bild AI (YC W25) Is Hiring Interns to Make Housing AffordableNext: Google reveals Nano Banana 2 AI image model, coming to Gemini today →
Comments0