Projection
Definition
A projection consumes events from an event store or log, applies each one to a read model, and records a checkpoint of the last event processed.
In practice
Projections turn an event history into query-friendly views: an order list per customer, a daily sales total, a search index. Because events are the source of truth, a broken or new projection can be rebuilt by replaying from the start, and several projections can serve different screens from the same events.
Projections are asynchronous, so they lag behind writes; the lag shows up as stale answers rather than errors, so monitor checkpoint position and backlog age. Handlers must be idempotent or track checkpoints transactionally, since events may be redelivered after a crash, and a full rebuild over millions of events can take hours.
Example
The OrderSummaryProjector handles OrderPlaced and OrderShipped, upserts rows in order_summary, and stores checkpoint 1,204,331; 2 seconds of lag means "My orders" may miss the last order.