Dependency cruiser is a static analysis tool that validates and visualizes dependencies in JavaScript, TypeScript, CoffeeScript, and related projects.
The tool solves the problem of maintaining architectural integrity in codebases by analyzing dependency graphs and enforcing custom rules. It parses projects to identify all dependencies across ES6, CommonJS, and AMD module systems, then validates them against user-defined rules and reports violations both as text output for build systems and as visual graphs. The approach works by running through a project's dependencies, checking them against configured rules, and generating output in multiple formats including GraphViz dot notation for visualization.
Teams should adopt this tool when they need to prevent architectural drift, detect circular dependencies, or enforce dependency policies across their codebase. It suits projects of any size that want to maintain clear separation of concerns and catch dependency violations early in development. The tool generates output in formats including dot, mermaid, JSON, CSV, HTML, and plain text, giving teams flexibility in how they consume and present dependency information. The initialization command generates a starter configuration with sensible defaults for common issues like circular dependencies, missing package.json entries, and production code depending on dev dependencies, which teams can then customize with their own rules.
The project maintains active engagement with its codebase through regular updates and refinements to its rule system and output capabilities. Development shows consistent attention to supporting multiple module systems and output formats, with documentation covering real-world usage examples and detailed configuration options. The tool receives ongoing maintenance that addresses both core functionality and the breadth of JavaScript ecosystem variations it needs to handle.