Event sourcing
Store every change as an immutable event in an append-only log, and compute the current state by replaying the events.
How they work
Each entity, such as an order or an account, gets its own stream: the ordered events that record every change to it. To handle a command, the application reads the stream, replays the events to rebuild the current state (“rehydration”), checks its rules and appends new events. Events are never edited: a mistake is undone by appending a compensating event, such as ReservationCanceled after SeatsReserved. When streams grow long, a snapshot of the state every N events lets the application replay only what came after it; the snapshot is a cache, and the events stay the source of truth.
Reads usually come from projections: handlers follow the events and keep query-friendly read models up to date, which is why event sourcing pairs naturally with CQRS. Those views lag the log slightly, and since delivery is typically at least once, handlers must be idempotent. Because every event is kept, you can rebuild the state as of any point, or build a new read model from the whole history.
The store can be a purpose-built event store such as KurrentDB, with per-stream reads and an expected-version check on every append for optimistic concurrency, or an append-only table in a general-purpose database. A message broker such as Apache Kafka is not a substitute: it typically lacks per-entity stream reads and optimistic concurrency, though it works well for fanning events out to consumers.
Technologies
What all persistence: state, events and replay have in common →
Axon FrameworkOpen sourceA Java framework, not a database, for building event-sourced applications with CQRS and domain-driven design: commands, events and queries as messages, plus an event store to keep the events in. Axon Framework | Open source | Axoniq | Apache 2.0; the Axoniq Framework modules on top of it are commercial and need a subscription for production | 2026-10-08 |
| Commercial product | Kurrent | Kurrent License v1 (source available, not OSI open source) since 25.0 in March 2025; Event Store License v2 for 24.10; a BSD 3-clause license for earlier versions | 2026-10-08 |