Keep domain events as the authoritative history and derive current state by replay.
The problem
Overwriting current balance loses the sequence of business facts needed to explain or reconstruct it.
When it fits
History and reconstruction are important enough to justify event contracts, stream concurrency and long-term replay maintenance.
The whole architecture
Architecture diagram
The event stream is authoritative; read projections and optional snapshots are derived from a known stream position.
Blue arrows are commands or queries; purple arrows carry persisted events; gray arrows show rebuild control.
Scroll to pan. Select a component for its role.
API / data call
Event / job flow
Control / recovery
Select a component, or focus it and press Enter, to read its role.
SQL-authoritative CDC is a different source-of-truth choice from the event store shown here.
Snapshots and projections must retain their corresponding event positions.
Walk through the design
Follow one operation
Select a step to highlight its participants. This conceptual walkthrough is separate from challenge scoring.
The event store is authoritative in this lesson. This differs from the SQL-authoritative CDC recovery practice.
Step 1 of 3
Check the stream version
The command handler evaluates the operation against the current aggregate state and expected stream revision.
Trade-offs to make explicit
Events become the system of record; a projection or snapshot can accelerate reads but must remain tied to a valid event position.
Schema evolution, retention, privacy and deterministic replay add cost. Ordinary CRUD plus CDC does not by itself turn domain events into authoritative state.
Failure modes to plan for
Concurrent commands can append incompatible decisions unless stream versions or another concurrency control protect the invariant.
Replaying historical events can repeat external effects unless rebuilding projections is separated from live effect delivery.
Before you build
Explain your decision
Which records are authoritative, and how would you rebuild a projection without re-sending old notifications?
Use Plan & estimate inside practice to record your assumptions and trade-offs.
Original PractiseGrid explanations and conceptual diagrams, with primary references for further study. Dedicated scored exercises can be added as coverage grows.