What is event sourcing?

Definition

An event-sourced system preserves the changes that produced its state instead of retaining only the latest result. Processing the recorded events can reconstruct an earlier state or rebuild the current one.

For example, a parcel tracker could record that a package was collected, reached a depot and departed for delivery. Replaying those events reconstructs its recorded journey. Reconstructing software state does not itself reverse physical deliveries or other effects outside that state.

ELI5

Event sourcing keeps the steps that led to a result, so a system can work out the current situation from that record.

For example, a shared list records adding apples and then removing them. Applying those events leaves no apples on the current list while preserving what happened.

Is every activity log event sourcing?

No. In event sourcing, the recorded events drive the application's state changes, rather than merely describing them afterward.

Can events reconstruct a past state?

Yes, applying the relevant events in order can rebuild the application's recorded state at that point.

  1. Yohei Nakajima beside the blue-and-white headline RECORD EVERY CHANGE on a black background.
  2. Ishaan Sehgal discusses durable agent histories.
Definition card for event sourcing: What is event sourcing?

Event sourcing records application state changes as an ordered sequence of events, allowing state to be reconstructed by applying those events.