Expand description
§Eventide
A pragmatic Rust toolkit for Domain-Driven Design with first-class support for event sourcing and CQRS.
This umbrella crate re-exports the three building blocks that make up the toolkit so you can depend on a single crate and pull in everything you need:
| Module | Source crate | Purpose |
|---|---|---|
domain | eventide-domain | Aggregates, entities, value objects, events, repositories. |
application | eventide-application | Command bus, query bus, handlers, application context. |
macros | eventide-macros | #[entity], #[entity_id], #[domain_event], #[value_object]. |
§Quick start
Add the crate to your Cargo.toml:
[dependencies]
eventide = "0.1"
serde = { version = "1", features = ["derive"] }Then bring the most common items into scope through the prelude:
ⓘ
use eventide::prelude::*;
#[entity_id]
struct UserId(String);
#[entity(id = UserId)]
#[derive(Clone, Default)]
struct User {
name: String,
}§Feature flags
All flags are enabled by default. Disable them selectively with
default-features = false to trim the dependency tree.
eventing(default) — pull ineventide_domain::eventing, the asynchronous event bus / engine / dispatcher built on top oftokio.macros(default) — re-exporteventide_macrosasmacros.application(default) — re-exporteventide_applicationasapplication.infra-sqlx— opt-insqlxconversions on serialized events and snapshots so infrastructure crates can talk to a Postgres-backed event store without forcing a database driver into the domain layer.
§Layered architecture
eventide is intentionally split into independent crates so the pieces
you do not need can be left out. The dependency graph flows in one
direction:
eventide-application → eventide-domain ← eventide-macros
↑
└──── (optional) infra-sqlxDomain code never depends on application or infrastructure types, which keeps your business logic pure and easy to test.
Re-exports§
pub use eventide_domain as domain;pub use eventide_domain::async_trait;pub use eventide_domain::tokio;eventingpub use eventide_application as application;applicationpub use eventide_macros as macros;macros
Modules§
- prelude
- Curated set of imports that cover the day-to-day needs of writing aggregates, events, commands and queries.
Attribute Macros§
- async_
trait - Re-export of the [
async_trait] crate so users can write#[async_trait]on their own trait impls (e.g.domain::domain_service::DomainService,domain::eventing::EventHandler) without adding a directasync-traitdependency.