← Back to microservices patterns map
📜
Microservices Pattern

Event Sourcing

Store every state change as an immutable event and rebuild state by replaying events.

events

Detailed Description

Event sourcing stores history, not just current state. This is powerful for audit-heavy domains.

The cost is that event schemas live forever and projections must be maintained carefully.

Visual Diagram

AccountOpened
MoneyDeposited
MoneyWithdrawn
Replay -> current balance

Tradeoffs

Pros

Full audit trail, temporal debugging

Cons

Complex modeling and event versioning

Examples: EventStoreDB, Axon, custom event logs