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.
Summary
Section titled “Summary”ESDM answers: how do commands, recorded events and projections describe a domain’s evolution?
When to use it
Section titled “When to use it”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.
Common mistakes
Section titled “Common mistakes”- 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.
Background and history
Section titled “Background and history”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.
Alternatives and trade-offs
Section titled “Alternatives and trade-offs”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.
References
Section titled “References”- 2005 account
- Learning with models — choose a practice workflow and interpret its results.
Where it fits
Section titled “Where it fits”| Model | Captures | Use case |
|---|---|---|
| DDD | Snapshot state | Tactical |
| Context Map | Bounded contexts + integration patterns | Strategic |
| ESDM | Event-sourced state evolution + read models | Tactical + analytics |
Node types
Section titled “Node types”bounded-context— same boundary as DDD / Context Mapaggregate— consistency boundary (matches DDD’s)command— input intent; produces eventsdomain-event— fact that happenedread-model— query-optimized projection, fed by event projectionsquery— typed read against a read modelpolicy— reacts to events; emits commands (deliveryGuarantee + idempotency declared)process-manager— stateful saga-style orchestratordomain-service— stateless operationexternal-system— outside our control; not a bounded contextactor— human or system that issues commands
File format
Section titled “File format”Stored as models/esdm.json. See the esdm schema page for the normative JSON Schema and committed sample files.
