Search docs

Docs search
Back to Rule Catalog
AP-DOM-001Domain Model Quality

Anemic domain model

Flags domain objects that appear to expose data without owning behavior or invariants.

warningviolationNo auto-fix

How to fix

  1. Move invariant checks into the domain object or focused domain service.
  2. Keep DTOs separate from domain behavior.
  3. Add tests around the domain rule being protected.

What the rule validates

Business rules are scattered around a data structure instead of living with the domain concept.

Why it matters

Anemic models make invariants harder to protect and duplicate business rules across layers.

Common causes

  • DTOs or ORM entities are treated as domain objects.
  • Services contain all domain decisions.
  • The domain model has not been extracted yet.

Typical violation example

Every service checks subscription status differently before changing billing state.

Typical compliant example

A Subscription domain object owns allowed status transitions.

Related rules

Adjacent categories

Related files/config

  • apps/api/src/modules
  • packages

Related CLI commands

  • archpilot validate
  • archpilot validate --ci
AP-DOM-001 - Anemic domain model | ArchPilot Docs