Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Model boundaries example

The repository includes a runnable application with separate domain, persistence, public contract, API, and composition-root crates:

shop-persistence --> shop-domain
shop-api ---------> shop-domain
shop-api ---------> shop-contract
shop-app ---------> all model and adapter crates

From the repository root, run the Rust architecture test:

cargo test \
  --manifest-path examples/model-boundaries/Cargo.toml \
  -p architecture-tests

Run the equivalent TOML rules through the CLI:

cargo run -p cargo-bylaw -- check \
  --config examples/model-boundaries/bylaw.toml

The expected result is:

architecture checks passed (6 rules)

The test suite also contains real passing and intentionally failing Rust architecture tests:

cargo test -p bylaw --test architecture_test_e2e

The parent harness verifies that the passing test succeeds and that the failing test exits non-zero with the expected boundary and cycle diagnostics.