◆ arch_guard

arch_guard

arch_guard keeps the architecture of a Dart or Flutter project the way you meant it. It reads every import, export and part directive and then:

It runs in the terminal, as a pre-commit hook, and in CI, where it can comment on pull requests and report to GitHub Code Scanning.

Interactive dependency graph with two circular dependency groups

Quickstart

dart pub add --dev arch_guard
dart run arch_guard init     # detects your layout and writes arch_guard.yaml
dart run arch_guard          # checks the project

init recognises Clean Architecture, Riverpod, Bloc and feature-first layouts. On an existing codebase, record today’s problems with dart run arch_guard --update-baseline so that only new problems fail from then on.

Terminal report with cycles and a layer violation

Where next

If you want to… Read
Pick and adjust rules for your architecture Presets
Write layers by hand, ignore files, use workspaces Configuration
Run it on pull requests or before commits CI & hooks
See every flag, output format and exit code CLI
Build your own tooling on top Dart API

Found a bug or missing a preset? Open an issue.