Storing Events¶
Once an event has been produced, it needs to be stored permanently. This is the role of the event store.
An event store is not just a database – it's a system designed to keep an immutable, ordered history of all events.
In Our Library¶
Let's say a member borrows a book. The system produces a BookBorrowed event. That event is saved to the event store – typically as part of a stream.
Each stream groups all events that belong to a specific entity. In this case, the stream might be tied to a copy or a loan.
The event store guarantees:
- Append-only: events are only added, never changed or removed
- Ordering: events stay in the order they were written
- Persistence: events are stored reliably and durably
The Event Log Is the Source of Truth¶
With Event Sourcing, there is no separate "current state" stored in a database. Instead, the system rebuilds the state by replaying the stored events.
That means the event store is not just an audit log – it's the foundation of how your application works.
Benefits of Storing Events This Way¶
- You can always trace what happened and when
- You can rebuild projections or read models at any time
- You can debug or explain business behavior using historical data
- You can create new views of the data later – without changing the write logic
In short: event storage gives you flexibility, traceability, and reliability.
Next up: Publishing Events – learn how stored events are made visible to the rest of the system.