Pattern 05 / DATA

Event Sourcing

Use this when needing a perfect audit trail and the ability to reconstruct old states.

Pressure
Needing a perfect audit trail and the ability to reconstruct old states
Mechanism
Store facts as immutable events and derive current state by replaying or snapshotting those events
Toll
Schema evolution, replay cost, and unbounded event growth require discipline
Architecture plate05
Diagram for Event Sourcing
Executive brief

Event Sourcing fits when needing a perfect audit trail and the ability to reconstruct old states. Mechanism: store facts as immutable events and derive current state by replaying or snapshotting those events. Use it for finance, compliance, order lifecycle, healthcare audit, and state reconstruction. The toll: schema evolution, replay cost, and unbounded event growth require discipline.

Use when

Finance, compliance, order lifecycle, healthcare audit, and state reconstruction.

Example

Ordercreated → itemadded → paymentcaptured → shipped.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Data Storage Patterns

01Primary-Replica (Leader-Follower)02Sharding (Horizontal Partitioning)03Consistent Hashing04Write-Ahead Log (WAL)06CQRS (Command Query Responsibility Segregation)
← 0406 →