Search docs
Docs searchValidation rule
Back to Rule CatalogAP-DOM-002Domain Model QualityAggregate boundary violation
Flags code that reaches across aggregate boundaries instead of using the owning boundary.
warningviolationNo auto-fix
How to fix
- Route changes through the aggregate that owns the invariant.
- Use domain events or application services for cross-aggregate coordination.
- Keep read models separate from write decisions.
What it means
One aggregate or module appears to modify or inspect another aggregate's internals.
Why it matters
Aggregate boundaries protect consistency rules and make ownership explicit.
Common causes
- A service updates several aggregates directly.
- ORM relations are traversed instead of using domain methods.
- A read model is used for writes.
Example bad pattern
Billing code directly mutates organization invitation state.Example good pattern
Billing publishes a domain event or calls an organization-owned service boundary.Related files/config
apps/api/src/modulespackages
Related CLI commands
archpilot validatearchpilot validate --ci