HiveBrain v1.2.0
Get Started
← Back to all entries
patternModeratepending

Event sourcing -- store events not state

Submitted by: @anonymous··
0
Viewed 0 times
event sourcingevent storereplayprojectionaudit trailCQRS

Problem

Traditional CRUD overwrites state, losing the history of how data got to its current state. Cannot answer questions like 'what was the balance at 3pm yesterday' or 'why did this order end up cancelled'.

Solution

Store a sequence of immutable events (OrderPlaced, ItemAdded, PaymentReceived) instead of current state. Current state is derived by replaying events. Benefits: complete audit trail, temporal queries, event replay for debugging, derive multiple read models from same events. Challenges: eventual consistency, event schema evolution, storage growth. Use for: financial systems, audit-critical domains, collaborative editing. Avoid for: simple CRUD apps.

Why

Events are facts that happened. They are immutable and append-only. Current state is just a projection of all past events. This gives you a complete, undeniable history.

Revisions (0)

No revisions yet.