event_hex 0.0.3

A pragmatic Rust toolkit for Domain-Driven Design with first-class support for event sourcing and CQRS.
Documentation

event_hex

Russian version: README.ru.md

Why event_hex

  • Hexagonal-friendly. All abstractions are designed with hexagonal architecture layering in mind. All examples are built on hexagonal architecture with detailed explanations of what each architectural layer is responsible for.
  • Event Sourcing. Aggregates generate domain events, EventStore persists them, DomainEventHandler allows you to asynchronously apply any necessary logic in response to a published event.
  • Event Store. The event store is a central place for storing events - it is the source of truth. Events cannot be deleted or modified, and the library takes this into account.
    • The event store supports storing the hash of the previous event, creating a chain of linked events. When restoring an aggregate's state, these hashes are verified. It is therefore impossible to modify an event without the system detecting it.
    • Aggregate snapshots are supported to avoid replaying all events from the beginning.
    • Built-in Concurrency Conflict support. It is impossible to save two events with the same version.
    • MongoDB and PostgreSQL are supported, and you can also write your own storage implementation.
  • CQRS by default. CQRS fits perfectly into a hexagonal architecture. An in-memory CommandBus is implemented for processing commands, and a QueryBus is implemented for processing queries, both with the ability to register handlers.
  • Async. Built on the Tokio async runtime.

License

Licensed under one of the following licenses: