Madge is a developer tool for generating visual graphs of your module dependencies, finding circular dependencies, and providing other dependency analysis information.
Madge solves the problem of understanding and visualizing complex module dependency structures in JavaScript and CSS projects. It works by extracting the dependency tree from your codebase and rendering it as a visual graph, making it easy to spot problematic patterns. The tool supports multiple module formats including AMD, CommonJS, and ES6 modules, as well as CSS preprocessors like Sass, Stylus, and Less. By default it excludes NPM-installed dependencies and Node.js core modules, focusing your analysis on your own code while automatically traversing child dependencies.
You should choose Madge if you need to understand the dependency structure of a JavaScript or CSS project, particularly when hunting for circular dependencies that can cause maintenance headaches. It works well for projects of any size where visualizing module relationships provides value. The tool offers both a command-line interface and a programmatic API, so you can integrate it into build processes or use it as a standalone analysis tool. The API provides methods to extract specific information like orphaned modules, leaf modules with no dependencies, and modules that depend on a given module.
Development on the project shows sustained engagement with regular updates to the codebase. The maintainer has actively refined the tool over time, responding to user needs and expanding its capabilities across different module systems and stylesheet languages.