What problem does it solve?
In CQRS, aggregates are optimised for enforcing invariants, not serving screens. Querying them directly couples read performance to write-side structure and blocks UI evolution on domain model changes.
A read model is a projection — it consumes domain events and maintains a denormalised, query-optimised representation shaped for one view. Each read model serves a specific view spec, updated asynchronously as events occur.
Core Features & Use Cases
- Start from the view spec (V-XX) and map fields, filters, and sorts to read model fields.
- Trace back to source events that create or modify data. A single read model typically consumes events from multiple aggregates.
- Define the schema, indexes, and staleness tolerance to match UX requirements.
- Integration test pattern to verify that consuming domain events produces the expected projection state.
Quick Start
Generate the read-model specification RM-XX from the view spec V-XX and related domain events, then create the initial projection tests.