Software → Software Architecture
CQRS
An architectural pattern that separates commands that change state from queries that read state.
Motivation
CQRS solves the problem of forcing writes and reads through the same model when they have different needs.
Where it fits
CQRS belongs to software architecture and system design. It often appears in complex domains, event-driven systems, and systems with heavy read optimization.
Mental model
Commands change state. Queries read state. The write model protects correctness; the read model is optimized for retrieval.
Common mistakes
- Applying CQRS to simple CRUD systems.
- Assuming CQRS always requires event sourcing.
- Forgetting that separate read models add operational complexity.