File, layer, and slice dependency policies
Architecture testing for Zig
ArchUnitZig
ArchUnitZig turns source dependencies into lazy, owned rule values. Its preview includes file boundaries, layers, slices, PlantUML, metrics, graph reports, native test helpers, and explicit memory ownership.
Zig package
zig fetch --save-exact=archunit https://github.com/LukasNiessen/ArchUnitZig/archive/refs/tags/v0.0.1.tar.gzconst std = @import("std");
const archunit = @import("archunit");
test "production files have no cycles" {
var files = try archunit.files(std.testing.allocator, .{});
defer files.deinit();
var scope = try files.inPath(&.{.{ .glob = "src/**/*.zig" }});
defer scope.deinit();
var should = try scope.should();
defer should.deinit();
var rule = try should.haveNoCycles();
defer rule.deinit(std.testing.allocator);
try archunit.expectPasses(&rule, .init(.init(std.testing.allocator, std.testing.io)));
}Capabilities
What ArchUnitZig brings to the test suite.
The family shares a recognizable architecture vocabulary while each implementation stays honest about its language, toolchain, and maturity.
Explicit allocator and ownership model
Zig-native metrics
PlantUML diagrams and graph reports
Structured errors and native test helpers
Versioned, immutable installation archive
Current maturity
Versioned preview
The v0.0.1 preview targets exactly Zig 0.16.0 and documents ownership and compatibility explicitly.
Where it fits
Put boundaries next to the code they protect.
Common starting points for ArchUnitZig 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 ArchUnitZig ↗