Cargo workspace discovery
Architecture testing for Rust
ArchUnitRust
Write architecture policies as regular Rust tests. ArchUnitRust discovers the containing Cargo project, analyzes production targets, and provides file, layer, slice, metric, diagram, and graph APIs with explicit failure boundaries.
Cargo
cargo add --dev --git https://github.com/LukasNiessen/ArchUnitRust archunituse archunit::{assert_passes, project_files};
#[test]
fn api_does_not_reach_database() {
let rule = project_files()
.in_path("src/api/**")
.should_not()
.depend_on_files()
.in_path("src/database/**");
assert_passes!(rule);
}Capabilities
What ArchUnitRust brings to the test suite.
The family shares a recognizable architecture vocabulary while each implementation stays honest about its language, toolchain, and maturity.
File, layer, and captured-slice policies
Rust-native metrics and graph reports
PlantUML conformance and export
Structured violations and Checkable rules
Compiled README examples and doctests
Current maturity
Git preview
Usable directly from Git and under active development. It is not yet published on crates.io.
Where it fits
Put boundaries next to the code they protect.
Common starting points for ArchUnitRust include the following project shapes.
More ecosystems
The same intent, expressed natively.
Explore sibling implementations and carry the architecture vocabulary across a polyglot system.
Make the first boundary executable.
Add one meaningful rule, run it with the existing tests, and grow the architecture suite as the system reveals where it needs protection.
Start with ArchUnitRust ↗