The guide
The guide
Keep your data true on devices, at the edge and in the cloud: where to start, what to build, and how it works. Every Rust example in it is checked by the repository's tests.
Start from what you want
- See it work. Your first encounter: three short programs that end with the store refusing a write that would have broken a rule.
- Plan your app. Choose a topology: where each log, view and decision lives across devices, the edge and the cloud.
- Pick a database. Choose a store: SQLite, Postgres, Neon or a Durable Object, and what each one refuses.
- Run at the edge. Run on a Durable Object: the event store inside Cloudflare, next to your users.
By pillar
| You want your data to stay… | Read |
|---|---|
| True offline | Choose a topology, then Sync a device to a central store |
| True to your rules | Appending under a condition, carrying your rule into your domain, retrying a command safely |
| True to its history | Rebuilding a read model, the worked example |
| True wherever it lives | Choose a store, run on a Durable Object, bring your own store |
New to event sourcing?
Four short background pages, each ending with a link to the next. Read them if the pages above use words you have not met.
- Events, and the systems built on them: what an event is, and why systems are built around them.
- Event sourcing, and CQRS: what changes when the events become the record.
- Aggregates, and the boundary drawn in advance: how most event-sourced systems keep decisions safe, and where that runs out.
- Dynamic consistency boundaries: how happenstance checks a rule across as many records as it needs.
Everything else
Every page states, under its title, the one question it answers, and the menu groups them by what you want to do: understand an idea, learn by running code, or get a specific job done. The reference says what is checked and where, and the API documents every public item.
The pages live in the repository's docs/ directory, and this site renders
them unchanged: an example that stopped compiling would fail the build before it
reached you.
Learn
- Your first encounterHow does happenstance stop two writers breaking a rule?
Find your way
- Read the worked exampleWhere can I read a complete DCB program?
Understand
- Events, and the systems built on themWhat is an event, and why build a system around them?
- Event sourcing, and CQRSWhat changes when events become the source of truth?
- Aggregates, and the boundary drawn in advanceHow do most event-sourced systems keep a decision safe?
- Dynamic consistency boundariesHow does DCB keep a decision safe without aggregates?
- Boundaries, not aggregatesIf I don't define aggregates, what keeps my decisions consistent?
- Carry your invariant acrossHow do I write my own rule in this library's terms?
- Appending under a conditionWhy does the store re-check my query when I append?
- What to read before you write an adapterWhat should I read, and in what order, before writing an adapter?
Do
- Retry a commandHow do I retry a command safely, without applying it twice?
- Rebuild a read modelHow do I rebuild a read model from the log?
- Choose a storeWhich event store should my deployment run on?
- Choose a topologyWhere should each log, view and decision live in my app?
- Run on a Durable ObjectHow do I run the event store inside a Cloudflare Durable Object?
- Sync a device to a central storeHow do I keep a device's event store in sync with a central one?
- Pass the conformance suiteHow do I make my adapter pass the conformance suite?
- Upgrading from 0.3 to 0.4How do I move my code from 0.3 to 0.4?
- Upgrading from 0.4 to 0.5How do I move my code from 0.4 to 0.5?
- Upgrading from 0.5 to 0.6How do I move my code from 0.5 to 0.6?