cargo arc draws a Cargo workspace as a collapsible arc diagram in SVG, a tree of your crates and their modules connected by arcs that trace the use dependencies between them.
cargo arc check holds the same workspace against architecture rules you write down, and fails the build when one breaks.
cargo install cargo-arcRequires a stable Rust toolchain.
# In any Cargo workspace:
cargo arc -o deps.svg # the arc diagram
cargo arc check # the architecture rulesOpen the generated SVG in a browser.
Your workspace shows up as a tree — crates with their modules nested inside. Arcs between nodes show where dependencies exist.
- Boxes — crates and modules, nested by hierarchy
- Arcs — dependencies between any two nodes
- Collapse a node to fold its children — individual dependencies merge into summary arcs
- Select a node or arc to highlight its relationships
- Cycles — circular dependencies are detected and highlighted
cargo arc hotspots shows which files are large and change often, the files that usually cost the most to maintain.
It ranks them by lines of code times commits and draws the workspace as nested circles, sized by lines and colored by commits.
cargo arc ui serves the map beside the arc diagram, so a hotspot can be looked up there to see what depends on it.
The arc diagram can live beside the code.
cargo arc ui serves it for an editor plugin, and a click on a node or a reference opens the file in the editor.
In the other direction, the arc diagram selects the node of the file the editor shows.
Plugins exist for Neovim, VS Code and RustRover.
Circular dependencies are forbidden by default, and a workspace without a rules file is checked against that one rule.
arc-rules.toml states which crate may depend on which, which modules or crates may never depend directly on which, and where circular dependencies are permitted after all.
cargo arc check reports what it finds, and a reported error makes it exit non-zero, so it belongs in CI next to the test suite.
A workspace that has grown for years rarely comes out clean on the first run.
cargo arc check --generate-baseline freezes what exists today, so the run turns green and reports everything added after it.
cfg attributes are currently not evaluated, so the graph is the union over all configurations.
A module under #[cfg(feature = "hydrate")] or #[cfg(target_os = "windows")] is walked on any machine and under any feature set.
Two modules whose attributes exclude each other are currently reported as one tangle, although the reported circular dependency exists in no build.
Modules under #[cfg(test)] are the exception and stay out unless --include-tests is passed.
A mod declaration inside a macro invocation is not analyzed.
Where a crate writes feature_gate! { pub mod runtime; }, runtime and every module below it are missing from the graph, and a rule naming it reports unmatched-pattern.
A pattern reaches the crates under analysis and the modules in them. A crate the workspace only depends on is not a node, so a rule about a third-party crate matches nothing.
A green run says the rules held over the modules the run walked, and a module a macro declares is not one of them.
- docs/ARC_DIAGRAM.md — the arc diagram: what it draws, interaction, filters, flags
- docs/HOTSPOT_MAP.md — the hotspot map: what it measures, the hotspots, use beside the arc diagram
- docs/RULES.md — the rules: how to start, the baseline, the file format
- docs/GLOSSARY.md — the terms of the domain
- cargo tree — built-in textual dependency tree (crate-level)
- cargo-modules — module tree and dependency visualization
- cargo-depgraph — crate-level dependency graph as DOT with color-coded dependency kinds
- cargo-coupling — coupling analysis based on Khononov's framework
The arc diagram layout is inspired by Martin Wattenberg's Arc Diagrams: Visualizing Structure in Strings (IEEE InfoVis 2002).
See docs/ARCHITECTURE.md for project structure and architecture decision records.
just build
just test # Rust + JS
just lint # clippy + format check
just fmtMIT OR Apache-2.0