EventStore
01 / 02

EventStore Fundamentals: Streams, Immutability & Replay

EventStore: Streams, Immutability & Replay

EventStoreDB is a database purpose-built for storing streams of immutable events, designed around the event sourcing pattern -- persisting every change as an event, rather than only the current state.

Streams

Stream: order-123
  1. OrderPlaced      { items: [...], total: 49.99 }
  2. PaymentReceived  { amount: 49.99, method: "card" }
  3. OrderShipped      { carrier: "UPS", trackingId: "1Z..." }

# An ordered, append-only sequence of events for ONE entity --
# replaying them in order reconstructs the order's current state

Why Events Are Immutable

An event represents a historical fact that already happened -- mutating it after the fact would falsify the recorded history. The append-only, immutable design preserves an accurate, complete audit trail without separate audit-logging infrastructure.

Optimistic Concurrency

Appending with an expected stream version lets EventStore detect if another writer already appended events since the caller last read the stream -- rejecting the write rather than silently conflicting with a concurrent change.

Snapshots for Long Streams

For a stream with many thousands of events, replaying everything from the start each time can get slow. A periodically-saved snapshot lets reconstruction resume from a checkpoint plus only the events since, improving performance.

Keep your own version of these notes — editable, searchable, and organised by your stack.

Start free