Design a store where state is derived from an immutable event log. Support optimistic concurrency, projections, snapshots, and replay for debugging or regulatory replay.
Functional requirements
- Append-only events with monotonic stream versions per aggregate
- Load aggregate by replaying events or hydrating from snapshots
- Projections (CQRS read models) built asynchronously from the stream
- Schema evolution with upcasters or versioned events
- Time-travel queries and export for audit
Non-functional requirements
- High append throughput with partition scaling
- Idempotent projection workers with at-least-once delivery
- Compaction or snapshot policy to bound replay time
- Strong write ordering per aggregate key