Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

Add sourcery to your Cargo.toml:

[dependencies]
sourcery = "0.1"
serde = { version = "1", features = ["derive"] }

The crate re-exports the derive macro, so you don’t need a separate dependency for sourcery-macros.

Feature Flags

FeatureDescription
test-utilEnables TestFramework for given-when-then aggregate testing
postgresPostgreSQL event store via sqlx

To enable test utilities:

[dev-dependencies]
sourcery = { version = "0.1", features = ["test-util"] }

To use the PostgreSQL store:

[dependencies]
sourcery = { version = "0.1", features = ["postgres"] }

Minimum Rust Version

This crate requires Rust 1.88.0 or later (edition 2024).

Next

Quick Start — Build your first aggregate