Skip to content

What is Event Sourcing?

Event Sourcing is a way of storing data that focuses on what happened, not just what is.

Instead of saving the current state of an object or record, you store a series of events that describe every change over time.

Each event is a fact – something that happened in the past. For example:

  • "BookBorrowed"
  • "LoanExtended"
  • "LateFeePaid"

These events are stored in the order they occurred, and together they form the complete history of a business entity.

How is That Different from Traditional Storage?

In a typical CRUD system, you store the current state: "What's the user's name?" or "How many items are in stock?"

With Event Sourcing, you store how the state came to be:

The state is not stored – it's reconstructed by replaying all events.

This allows you to:

  • Rebuild the current state at any time
  • Understand exactly when and why something happened
  • Audit and debug with full traceability

Why Store Events?

Storing events provides several important advantages:

  • Traceability: You see how something changed, not just that it changed.
  • Auditability: Every action is recorded – no data is lost.
  • Flexibility: You can create new read models later from the same history.
  • Consistency with CQRS: Event Sourcing pairs naturally with CQRS – commands generate events, and events drive projections.

A Different Mental Model

Event Sourcing isn't just a storage technique – it's a shift in thinking. You stop asking "What's the current value?" Instead, you ask "What has happened so far?"

Want to see how these events are used in practice? Next, explore Domain-Driven Design – and learn how to shape behavior from the business perspective.