Event sourcing explained in plain terms means understanding a different way to store data: instead of keeping only the current state, keep a record of every change that ever happened, and rebuild the state from that record whenever it is needed. The central question is how a system can know not just what is true now, but how it became true, and the answer is an event log, an append-only history of everything the system did.
Event sourcing is a pattern in which the state of an application is derived from a sequence of events, rather than stored directly. Each event describes something that happened, such as an order being placed or a payment being received, and the current state is produced by replaying those events in order from the beginning.
The idea is simple: state is a snapshot of history, and history is the truth. If the history is kept, the state can always be rebuilt, the past can always be inspected, and a mistake can be corrected by adding a new event rather than by rewriting what happened. This article explains what event sourcing is, how it works, and where it is used.
Key takeaways
- Event sourcing stores a history of events, not just the current state.
- The current state is rebuilt by replaying the events in order.
- Events are immutable: mistakes are fixed by new events, not edits.
- The log is a complete audit trail of everything that happened.
- It suits ledgers, audit-heavy systems, and complex business processes.
What event sourcing is
Event sourcing turns the usual way of storing data around. In a traditional system, a database row holds the current value, and the history of how it got there is lost when the row is overwritten. In an event-sourced system, the event log is the source of truth, and the current state is a projection of it, built by applying each event in turn, much as a bank balance is the result of applying every transaction on a statement.
Events are facts about the past, and they are immutable. Once an event is written, it is never changed or deleted, because changing history would make the state it produced impossible to reproduce. If something was recorded wrongly, the correction is a new event that reverses or adjusts it, so the history shows both the mistake and its correction.
The pattern was popularised by Martin Fowler in 2005, though the idea is older, and it grew out of the way accounting and ledger systems have always worked: a ledger records every transaction, and the balance is derived from it. Our guide to Kafka explains the log-based platform on which many event-sourced systems are built, and our guide to ACID explains the guarantees that a traditional database provides instead.
How event sourcing works
When something happens in the system, the application writes an event to the log. The event has a type, such as OrderPlaced or PaymentReceived, a timestamp, an identifier for the thing it concerns, and the data needed to describe what happened. The write is an append, which is fast, and once written, the event is never modified.
The current state is built by replaying the log. A projector reads the events in order and applies each one to an in-memory model, so that after the last event, the model holds the current state. The projection can be rebuilt at any time, from the same log, which means the state can be reconstructed exactly, even after a total loss of the read model.
Replaying the whole log from the beginning is slow when the log is long, so systems take snapshots. A snapshot is a saved copy of the state at a particular point in the log, and rebuilding starts from the latest snapshot and replays only the events after it. Snapshots make recovery fast while keeping the full history available for auditing.
Commands and queries are separated in most event-sourced designs. A command, such as PlaceOrder, is validated against the current state and, if it is valid, produces one or more events that are appended to the log. Queries then read from projections built from the log, which can be shaped for each use, so that a search view, a report view, and a dashboard view can all be built from the same events.
Changing the meaning of past events is handled by versioning. If the application changes how an event should be interpreted, it can write a new version of the projector that reads the old events and produces the new state, or it can migrate the log by appending corrected events. The old events stay as they were, so the history is never rewritten, only reinterpreted.

Comparing event sourcing with other ways to store state
Event sourcing is one of several ways to keep state, and each was built with a different emphasis. Storing the current state directly is simple and fast, while an audit log table records changes as a side effect, and each approach trades simplicity for history in a different way.
The table below sets out the main contrasts between the leading approaches.
| Aspect | Event sourcing | Current-state storage | Audit log table |
|---|---|---|---|
| What is stored | Every event, in order | Only the latest values | Changes, as a side record |
| Rebuilding state | Replay the log | Not possible from history | Partial, if the log is complete |
| Audit trail | Complete, by design | None, unless added | Partial, depends on logging |
| Storage growth | Grows with every event | Stable | Grows, but rarely queried |
| Best for | Ledgers and audit trails | Simple CRUD systems | Compliance on top of CRUD |
The practical result is that event sourcing is the right choice when the history itself is valuable, current-state storage suits simple applications where only the latest value matters, and an audit log is a lighter way to add accountability to a traditional system.
Where event sourcing is used
Banking and finance use event sourcing because a ledger is naturally a log of events. Every deposit, withdrawal, and transfer is an event, the balance is derived from them, and regulators can audit the complete history, which is exactly what a financial system is required to provide.
E-commerce uses event sourcing to track orders through their life. An order generates events as it is placed, paid, packed, shipped, and delivered, and the history of those events is what customer service reads when a customer asks where their order is, or what went wrong with it.
Collaborative software uses event sourcing to keep documents and projects in sync. Every edit is an event, and the current document is the result of replaying them, which makes it possible to show the full history of a document, to undo any change, and to synchronise collaborators by sharing the event log.
Internet of things systems use event sourcing to record sensor readings. Each reading is an event with a timestamp, and the current state of a device is derived from its recent events, while the full history is kept for analysis, so that a failure can be investigated by replaying exactly what the sensors reported.
Gaming uses event sourcing to record play. Every action a player takes is an event, and the game state is rebuilt from them, which makes it possible to replay a match, to audit for cheating, and to reconstruct the state after a crash without losing any player’s progress.
Strengths and limits
The greatest strength of event sourcing is that nothing is ever lost. The complete history is always available, so the system can answer questions about the past that were never anticipated when it was built, and it can rebuild any view of the data, old or new, from the same log.
It is also a strength that event sourcing makes debugging and auditing straightforward. A bug can be reproduced by replaying the events that led to it, and an auditor can verify every change, because the log is the record, not a summary of it.
The limits are real, though. Event sourcing is more complex than storing the current state, the log grows forever and needs snapshots and archiving, and changing the meaning of old events requires versioning and care. For a simple application that only needs the latest value, it is more machinery than the problem deserves.
Event sourcing checklist
- Use event sourcing only when the history itself is valuable.
- Make events immutable; correct mistakes with new events.
- Give every event a type, a timestamp, and an aggregate identifier.
- Take snapshots regularly so rebuilding stays fast.
- Version events so old ones can be read after a change.
- Separate commands, which produce events, from queries, which read projections.
- Plan for log growth, archiving, and retention from the start.
- Test replay: rebuilding from the log must reproduce the state exactly.
- Document the event schema; it is a public contract.
Frequently asked questions
What is event sourcing in simple terms?
It is a way of storing data as a history of everything that happened, rather than as the current state, so that the state can always be rebuilt by replaying the events in order.
What is the difference between an event and a state change?
An event is a fact about something that happened, such as an order being placed, while a state change is the effect of that fact on the current data. Event sourcing stores the facts and derives the effects.
How do you correct a mistake in event sourcing?
By appending a new event that reverses or adjusts it, never by editing the original. The history then shows both the mistake and its correction, which is what makes the audit trail trustworthy.
What is a projection?
It is a view of the current state built by replaying events, shaped for a particular use, such as a search index, a report, or a dashboard. Many projections can be built from the same event log.
Does event sourcing replace the database?
No. The event log is the source of truth, but projections are usually stored in a database for fast reading. The difference is that the database holds derived state, not the truth itself.
When should I not use event sourcing?
When the application only needs the latest value, when the history has no value, or when the team cannot afford the extra complexity. In those cases a traditional database is simpler and sufficient.
The bottom line
Event sourcing explained in one line is this: store everything that happened, and let the current state be the result of replaying it.
It is the pattern that turns a database into a complete history, and the reason a system can always explain how it got to where it is.
This article is general information about how event sourcing works, not advice about designing storage for a particular system.







