Expand description
§cqrs
A lightweight, opinionated CQRS and event sourcing framework targeting serverless architectures.
Command Query Responsibility Segregation (CQRS) is a pattern in Domain Driven Design that uses separate write and read models for application objects and interconnects them with events. Event sourcing uses the generated events as the source of truth for the state of the application.
Together these provide a number of benefits:
- Removes coupling between tests and application logic allowing limitless refactoring.
- Greater isolation of the aggregate.
- Ability to create views that more accurately model our business environment.
- A horizontally scalable read path.
Things that could be helpful:
- User guide along with an introduction to CQRS and event sourcing.
- Demo application using the axum http server.
- Change log
Three backing data stores are supported:
Modules§
- mem_
store - An in-memory event store suitable for local testing.
- persist
- Common persistence mechanisms.
- test
- This module provides a test framework for building a resilient test base around aggregates.
A
TestFrameworkshould be used to build a comprehensive set of aggregate tests to verify your application logic.
Structs§
- Cqrs
Framework - This is the base framework for applying commands to produce events.
- Event
Envelope EventEnvelopeis a data structure that encapsulates an event with its pertinent information. All of the associated data will be transported and persisted together and will be available for queries.
Enums§
- Aggregate
Error - The base error for the framework.
Traits§
- Aggregate
- In CQRS (and Domain Driven Design) an
Aggregateis the fundamental component that encapsulates the state and application logic (aka business rules) for the application. AnAggregateis always composed of a DDD entity along with all entities and value objects associated with it. - Aggregate
Context - Returns the aggregate as well as the context around it.
This is used internally within an
EventStoreto persist an aggregate instance and events with the correct context after it has been loaded and modified. - Domain
Event - A
DomainEventrepresents any business change in the state of anAggregate.DomainEvents are immutable, and when event sourcing is used they are the single source of truth. - Event
Store - The abstract central source for loading past events and committing new events.
- Query
- Each CQRS platform should have one or more queries where it will distribute committed events.
- View
- A
Viewrepresents a materialized view, generally serialized for persistence, that is updated by a query. This a read element in a CQRS system.