What is Event Sourcing

Definition

Event sourcing is a design pattern in which application state is stored not as a current snapshot but as an immutable, ordered log of every event that changed it, so the present state can always be rebuilt by replaying events from the beginning.
« Back to Glossary Index
  • Preserves a complete, immutable history of every change for audit and analysis
  • Allows state to be rebuilt or corrected by replaying the event log
  • Enables temporal queries that reconstruct state at any past point in time
  • Decouples state changes from their consumers, naturally fitting event-driven systems

Real World Example

A banking ledger uses event sourcing to record each deposit and withdrawal as an immutable event, so the current balance is derived by replaying events and a full, auditable history is preserved by design.

FAQs

How does event sourcing store state?

It stores an ordered, immutable sequence of events; current state is computed by replaying those events rather than overwriting a single record.

What is the main benefit of event sourcing?

A complete, auditable history that lets you reconstruct any past state and reason precisely about how the system reached its current state.

What is a trade-off of event sourcing?

It adds complexity, since reading current state requires replaying or maintaining projections, and the event log grows continuously.

Hello popup window