Event sourcing fundamentals

What is an event store database?

An event store database records ordered, immutable facts about state changes. Instead of keeping only the latest value, it preserves the sequence that produced that value. Applications derive current state through projections, trace results back to source events, and replay history to reconstruct earlier state.

Event sourcing is the model; the event store is the database

Event sourcing models application state as a sequence of accepted events. An event store database supplies the storage rules that model needs: ordered streams, append-only writes, version checks, durable positions, replay, and historical reads. Current-state tables and caches remain useful read models, but they are derived views rather than the only surviving record.

Differences between an event store database, a current-state database, and logs
SystemSource of truthHistorical answer
Event store databaseOrdered domain eventsReplay stream to sequence or timestamp
Current-state databaseLatest stored valuesNeeds audit tables, snapshots, or backups
Application logsOperational messagesCan explain execution but may not rebuild state

Four parts of the model

Events are facts

Each accepted event records what changed, when it changed, and which stream it belongs to. Corrections append another event; they do not edit history in place.

Streams preserve order

Related events form a stream, commonly scoped to one entity or process. Stream versions support optimistic concurrency and deterministic replay.

Projections answer reads

A projection folds events into a read model: account balance, order status, agent memory, dashboard totals, or any other current-state view.

Replay reconstructs state

Because source events remain available, systems can rebuild a projection, inspect a past point in time, or test corrected logic against recorded history.

Use one when history matters

  • Audit and compliance need a traceable sequence of decisions.
  • Projections must be rebuilt after logic changes.
  • Operators need point-in-time answers or replay debugging.
  • Agents must retain provenance across sessions.

Do not use one by default

A current-state database is usually simpler when overwriting rows is acceptable and you do not need replay, provenance, temporal queries, or multiple derived read models. Event sourcing adds modelling, versioning, and projection work; those costs need a real reason.

How AllSource maps the event-store model

AllSource Core accepts events into immutable streams backed by a checksummed write-ahead log and Parquet persistence. Query Service derives tenant-facing HTTP, realtime, analytics, and projection reads. Prime builds provenance-aware agent memory from the same durable history. Event payloads remain in the event store; product analytics receives only fixed interaction names and aggregate-safe properties.