Skip to content

Domain Model Implementation Standard

Purpose

The Domain Model Implementation Standard defines how aggregates, entities, value objects, policies, domain services, and domain events should be represented conceptually in backend implementation.

Domain Responsibilities

Element Responsibility
Aggregate Protects consistency boundary and invariants.
Entity Domain object with stable identity inside aggregate boundary.
Value object Immutable value with validation and meaning.
Policy Domain decision rule.
Domain service Domain behavior that does not belong naturally to one aggregate.
Domain event Past-tense fact produced by domain behavior.

Rules

  • Domain model uses business language from the Domain Model documents.
  • Domain model does not depend on controllers, DTOs, repositories, messaging, or provider adapters.
  • Aggregates enforce invariants before state changes are persisted.
  • Value objects validate meaning at construction or command boundary.
  • Domain events describe facts that already happened.
  • AI suggestions are not domain facts until accepted through owning domain behavior.

Domain Boundary

flowchart LR
    Command[Command]
    Aggregate[Aggregate]
    Policy[Policy]
    Event[Domain Event]

    Command --> Aggregate
    Aggregate --> Policy
    Aggregate --> Event

Forbidden Patterns

  • Anemic aggregates that only expose mutable fields.
  • Domain model depending on database annotations as the source of business meaning.
  • Cross-module aggregate references.
  • Generic domain helper packages.
  • Silent mutation of another module's source facts.