All glossary terms
Design

Event sourcing

Event sourcing is a persistence pattern that stores every state change as an immutable event in an append-only log. The current state of an entity is derived by replaying its events. Reading is fast because read models (projections) are pre-built from the event stream; writing is auditable because the event log is the system of record.

Event sourcing pairs naturally with CQRS — events drive both the audit log and the read-model projectors. The biggest benefits are time-travel debugging (replay events up to any past moment to see what state was), audit compliance (the event log IS the audit trail), and integration (downstream systems consume the same events). The biggest costs are schema migration (events are immutable; renaming a field requires upcasters), eventual consistency (projections lag the event log), and operational complexity (event-store backups, replay performance). It's a powerful pattern for the right domain — financial ledgers, multi-stakeholder workflows — and overkill for CRUD admin tools.

Related terms