Skip to content

ESDM — Event-Sourced DDD

This guide is split into three parts, and you are on Short info. Continue with the tutorial or browse the samples.

ESDM answers: how do commands, recorded events and projections describe a domain’s evolution?

Use the supported import workflow when an event-sourced design needs explicit commands, domain events, read models and policies. Start with one command, its resulting event and one projection. ESDM is import-only in the current model inventory: there is no standalone ESDM editor selection. A file/schema capability should not be mistaken for a full editor or running event store.

  • Recording a command as an event before the requested operation succeeds.
  • Assuming a replay may safely repeat every external side effect.
  • Confusing a valid imported model with a running event store or simulator.

Event sourcing represents changes as an event history from which state can be reconstructed. Martin Fowler’s 2005 account is a useful explanation of the idea and its consequences. ESDM is ContextBrew’s representation of event-sourced domain concepts; its name and file vocabulary are not an external standard.

Separate an intention to act from the fact that an action occurred: a command may fail, while a recorded domain event describes something that happened. A projection builds a query-oriented view, and a policy can react to an event by requesting another action. Event history introduces decisions about replay, evolution, idempotency and side effects. Import validation checks the model’s structure and references; it does not establish that a deployed system safely replays events or compensates a failed workflow.

Use conventional DDD with current-state persistence when full event history does not justify its operational cost. CQRS separates read/write models but does not require event sourcing. Event Storming helps discover behavior collaboratively without committing to an event-store implementation.

Model Captures Use case
DDD Snapshot state Tactical
Context Map Bounded contexts + integration patterns Strategic
ESDM Event-sourced state evolution + read models Tactical + analytics
  • bounded-context — same boundary as DDD / Context Map
  • aggregate — consistency boundary (matches DDD’s)
  • command — input intent; produces events
  • domain-event — fact that happened
  • read-model — query-optimized projection, fed by event projections
  • query — typed read against a read model
  • policy — reacts to events; emits commands (deliveryGuarantee + idempotency declared)
  • process-manager — stateful saga-style orchestrator
  • domain-service — stateless operation
  • external-system — outside our control; not a bounded context
  • actor — human or system that issues commands

Stored as models/esdm.json. See the esdm schema page for the normative JSON Schema and committed sample files.