Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Covers Event Sourcing and CQRS as DDD patterns: event streams, projections, snapshots, sagas, upcasting, and conflict resolution.
Use this skill ↓86% 95%+9 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 19 of 22 without it.
3 of 3 safety checks passed
Not used yet
Implementation patterns for DDD. Event Sourcing stores every state change as an immutable event and derives current state from replay. CQRS separates write and read models. These are tools, not mandatory architecture -- apply selectively to domains where they add value.
ES adds value when:
ES is overkill when:
Key question: "Does knowing the history of how we got here provide business value?" Yes -> consider ES. No -> traditional CRUD is simpler.
Events are immutable records of things that happened. Past tense: OrderPlaced, PaymentReceived, ItemShipped.
Event structure: Include all data needed to understand what happened (self-contained) | Use domain language | One event per meaningful business fact | Events carry data only, no behavior
Granularity: Too coarse (OrderUpdated { order: {...} }) loses what changed. Too fine (OrderFieldChanged { field, old, new }) is generic audit log. Just right (OrderConfirmed { orderId, confirmedBy, confirmedAt }) has clear business meaning.
Single source of truth. Core operations:
append(streamId, expectedVersion, events) -> success or concurrency conflictread(streamId) -> ordered list of eventssubscribe(filter) -> push notification for new eventsProperties: Append-only (never modify/delete) | Ordered within stream | Immutable | Versioned (each event has position)
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.