A Rust framework for building event-sourced systems with CQRS patterns.
Epoch is an opinionated event sourcing framework that prioritizes simplicity and performance. The core idea:
Aggregates are living snapshots. State is persisted immediately after every command — no event replay on reads. Events are still stored for audit, projections, and history. An opt-in versioned snapshot store enables historical state reconstruction when you need it.
[dependencies]
epoch = { version = "0.1", features = ["derive", "postgres"] }derive(default) — Proc macros for event data and enum subsettingin-memory— In-memory event store, bus, and snapshot store for testingpostgres— PostgreSQL-backed event store, bus, and snapshot storeupcasting— Forward-compatible event schema evolution via versioned JSON transformations
| Crate | Purpose |
|---|---|
epoch |
Main crate, re-exports with feature flags |
epoch_core |
Core traits and abstractions |
epoch_derive |
Proc macros (EventData, subset_enum) |
epoch_mem |
In-memory implementations (testing) |
epoch_pg |
PostgreSQL implementations (production) |
hello-world.rs— Basic aggregate and projection usagesaga-order-fulfillment.rs— Multi-aggregate saga coordinationevent-correlation-causation.rs— Event correlation and causation trackingversioned-snapshots.rs— Automatic snapshot capture, retention, and historicalstate_atreconstructionschema-evolution.rs— Forward-compatible event upcasting with chained steps and dead-letter policy (requires--features upcasting)
- Guide — Architecture, patterns, and design decisions
- Schema Evolution Guide — How to evolve persisted event schemas without breaking existing data
LGPL-3.0-or-later