Traditional CRUD vs Event Sourcing
CRUD: store current state
accounts: { id: 42, balance: 1000, status: "active" }
UPDATE accounts SET balance = 900 WHERE id = 42; -- information lost!
Event Sourcing: store history of events
events: [
{ account_id: 42, type: "Deposited", amount: 1000, at: t1 }
{ account_id: 42, type: "Withdrawn", amount: 100, at: t2 }
]
current_balance = fold(events) = 900
The current state is derived by replaying the event log. The log is the single source of truth.