Event Sourcing

Persist domain events as the primary state history.

Problem

Some domains need complete temporal reconstruction and alternative projections.

When to use it

  • Event semantics are stable and audit is central
  • Team can evolve/replay schemas

When not to use it

  • Ordinary audit logging is enough
  • Deletion/privacy requirements conflict with immutable payloads

Minimal example

Append AccountCredited v3 with expected stream version; fold events to derive balance.

Tradeoffs

  • Hard migrations and debugging
  • Snapshots, upcasters, privacy design, and projection repair are mandatory