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.

Versioned previewZig 0.16.0MIT

Zig package

zig fetch --save-exact=archunit https://github.com/LukasNiessen/ArchUnitZig/archive/refs/tags/v0.0.1.tar.gz
test/architecture.zig
const 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.

01

File, layer, and slice dependency policies

02

Explicit allocator and ownership model

03

Zig-native metrics

04

PlantUML diagrams and graph reports

05

Structured errors and native test helpers

06

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.

LanguageZig
Release0.0.1 preview
RuntimeZig 0.16.0
LicenseMIT

Where it fits

Put boundaries next to the code they protect.

Common starting points for ArchUnitZig include the following project shapes.

Zig librariesSystems toolsNative servicesCompiler projects

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 ↗