Event Sourcing Explained for Practical System Design
Learn event sourcing concepts, event stores, projections, auditability, replay, consistency, schema evolution, and when the pattern is worth using.
Event sourcing stores what happened, not only current state
In a typical CRUD system, the database stores the latest version of a record. Event sourcing stores a sequence of events that describe how the state changed: account created, email changed, order paid, shipment sent, subscription canceled. Current state is derived by replaying those events or by maintaining projections built from them.
This approach can be powerful when the history matters. Finance, logistics, collaboration, compliance, audit trails, and complex workflows often need to know not just what the state is, but how it became that way. Event sourcing gives a durable narrative of business facts.
Events should represent business facts
Good events are named around meaningful domain changes. InvoicePaid is clearer than RowUpdated. SeatAssigned says more than UserChanged. Event sourcing works best when events are part of the domain language and can be understood by product, engineering, and operations teams.
Events are usually immutable. If a mistake happens, the system records a corrective event instead of editing history. This gives strong auditability, but it also requires careful thinking about privacy, retention, and data correction laws. Immutability is useful, but it must be reconciled with real compliance needs.
- Use event sourcing when history and replay create real value.
- Design events as stable business facts, not database implementation details.
- Build projections for read models and user-facing queries.
- Plan schema evolution before events live for years.
Projections make events usable
Applications rarely query raw event streams for every screen. They build projections: read-optimized views such as account balances, order summaries, inventory status, or timelines. A projection can be rebuilt by replaying events, which is valuable when a bug is fixed or a new view is needed.
Projection lag is a product concern. If an event is accepted but the read model updates seconds later, users may briefly see old state. Some workflows tolerate this; others need immediate consistency. Event-sourced systems often require more explicit user experience design around eventual consistency.
Complexity is the main cost
Event sourcing adds concepts: event stores, streams, versions, projections, replay, snapshots, idempotent handlers, and schema migration. Debugging can be excellent when the system is well designed, but confusing when events are vague or projections are poorly owned.
Do not adopt event sourcing only because it sounds modern. Use it where auditability, replay, temporal history, or complex state transitions justify the added model. Many ordinary CRUD systems are better served by a relational database plus a clear audit log.
Make event history operationally safe
Monitor projection lag, failed handlers, event store growth, replay duration, and schema compatibility. Document event meaning and ownership. Event sourcing can be a strong architecture when history is a first-class product need. It is a burden when the team only wanted a more complicated way to save rows.