An event-sourced command-query system

5 unstable releases

0.3.1 Aug 7, 2019
0.3.0 Apr 29, 2019
0.2.1 Mar 8, 2019
0.2.0 Feb 4, 2019
0.1.0 Feb 1, 2019
Download history 1/week @ 2022-02-02 48/week @ 2022-02-16 5/week @ 2022-02-23 1/week @ 2022-03-09 40/week @ 2022-03-16 19/week @ 2022-03-23 8/week @ 2022-03-30 2/week @ 2022-04-13 1/week @ 2022-04-20 26/week @ 2022-04-27 31/week @ 2022-05-04 76/week @ 2022-05-11 22/week @ 2022-05-18

155 downloads per month
Used in cqrs-postgres




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.


To build all crates in this repository:

cargo build

To test all crates and documentation:

cargo test

To compile documentation for the crates in the repository (remove --no-deps to also include documentation for dependencies; add --open to automatically open the documentation in a browser):

cargo doc --no-deps

This crate aims to support the wasm32-unknown-unknown target for the cqrs, cqrs-core, and cqrs-todo-core crates. To build against this target, execute:

cargo build --target=wasm32-unknown-unknown -p cqrs-core -p cqrs -p cqrs-todo-core


cqrs is openly-licensed under the Apache-2.0 license.


~12K SLoC