Q46: What is event sourcing, and what are its trade-offs?

Difficulty:AdvancedTopic:Architecture

Event sourcing stores a sequence of domain events as the source of truth and derives current state by replaying those events. It provides an audit history and enables rebuilding projections, but requires event versioning, replay controls, snapshotting, and careful handling of corrections and sensitive-data deletion. Eventual consistency often appears in read projections. It is most useful when history and domain transitions are central requirements.

Key Takeaways
  • Events record state changes; projections build queryable views.
  • Plan event evolution, replay, snapshots, and privacy requirements.