Projection
ELI5 — The Vibe Check
A projection transforms raw events into a useful read model. Every time an 'OrderPlaced' event fires, the projection updates the dashboard table. It's like a live scoreboard operator who watches the game events and keeps the scoreboard updated.
Real Talk
In event sourcing, a projection is a function that processes a stream of events to build or update a read model/view. Projections can be synchronous (inline) or asynchronous, can be replayed from the beginning of the event stream, and multiple projections can produce different views from the same events.
When You'll Hear This
"We have three projections from the same event stream — one for the dashboard, one for analytics, one for search." / "If the projection is wrong, just fix it and replay all the events to rebuild the view."
Related Terms
CQRS
CQRS says: the way you write data and the way you read data should be separate systems. Writing (commands) goes to one model optimized for transactions.
Event Handler
An event handler is the code that says 'oh, something happened? Let me react to that.
Event Sourcing
Instead of storing 'balance: $100', event sourcing stores 'deposited $200, withdrew $50, withdrew $50'.
Read Model
A read model is a database view optimized specifically for reading — denormalized, pre-computed, and shaped exactly how the UI needs it.