cqrs
cqrs
is an event-driven framework for writing software that uses events as
the "source of truth" and implements command–query responsibility separation (CQRS).
The framework is built around a few key concepts:
- Events: The things that happened in the system
- Aggregates: Projections of events that calculate a view of the current state of the system
- Commands: Intentions which, when executed against an aggregate, may produce zero or more events, or which may be prohibited by the current state of an aggregate
- Reactions: Processes that execute an action when certain events occur in the system
The framework is written to be applicable to a generic backend, with an implementation provided for a PostgreSQL backend.
For an example of how to construct a domain which includes aggregates, events,
and commands, look at the cqrs-todo-core
crate, which is a simple to-do list
implementation.
The source repository also contains a binary in the cqrs-todoql-psql
directory
which demonstrates the use of the todo
domain in concert with the PostgreSQL
backend and a GraphQL frontend using the juniper
crate.