NEW
A pattern that records all state changes as an append-only sequence of events, enabling rebuilds, audits, and temporal queries.
DESCRIPTION
Event sourcing persists application state by storing immutable domain events rather than overwriting records. The current state is derived by replaying or projecting events. This approach provides a complete audit trail, supports temporal queries, and decouples write and read models, often with CQRS. It pairs well with stream processors and event stores for scalability. Challenges include event schema evolution, eventual consistency, and projection management. Strong governance of event design and versioning is essential.
ALTERNATIVE DEFINITIONS
Martin Fowler
Capture all changes to an application state as a sequence of events.
Canonical, succinct formulation widely cited in the community.
Wikipedia
Event sourcing is a software architectural pattern in which state changes are logged as a sequence of events.
Highlights logging-based approach to representing state changes.
Microsoft Learn
Use an append-only store to record the full series of events that describe actions taken on data in a domain.
Patterns catalog framing with guidance on implementation and usage.
RELATED TERMS
CQRS Change Data Capture Event Store Transaction Audit Data Apache Kafka Outbox Pattern Saga Pattern Stream Processing Domain-Driven Design
COMPETING TERMS
CRUD-based Persistence
KNOWLEDGE AREAS
Real-time & Streaming Data Software Engineering Data Architecture Data Modeling
TARGET AUDIENCE
Software Developer Data Engineer Data Architect DevOps Engineer Cloud Architect
EXTERNAL SOURCES
- Wikipedia - Event sourcing
- Microsoft - Azure pattern guidance
- EventStoreDB - Event store product docs
- Martin Fowler - Foundational article on pattern
TOP QUESTIONS
Why use Event Sourcing instead of CRUD-based persistence?
It preserves a complete history for audits, supports temporal queries, and decouples read models for performance and flexibility.
Category: Relevancy
How does Event Sourcing relate to CQRS?
Event sourcing complements CQRS: writes append events; reads use projections optimized for queries.
Category: Concept
What are the biggest challenges with Event Sourcing?
Event schema evolution, idempotency, and projection rebuild times are common challenges requiring careful versioning and tooling.
Category: Risks
How do you handle event versioning in Event Sourcing?
Use upcasters, schema evolution patterns, and maintain backward-compatible contracts to support replay of older events.
Category: HowTo
Is Event Sourcing suitable for all domains?
No. It suits domains with complex workflows, audit needs, and high write volumes; simpler CRUD may be sufficient elsewhere.
Category: Opinion
How do you rebuild state in Event Sourcing?
Replay the event stream or rebuild projections from checkpoints, potentially in parallel for faster recovery.
Category: HowTo
What storage backs Event Sourcing?
Specialized event stores or append-only logs (e.g., Kafka, EventStoreDB) with ordering and durability guarantees.
Category: Requirements
How do you ensure exactly-once semantics in Event Sourcing?
Use idempotent handlers, deduplication keys, and transactional outbox patterns to handle retries safely.
Category: Testing
What is a hot topic around Event Sourcing today?
Stream-native architectures integrating real-time analytics and materialized views with event-sourced domains.
Category: Topic