Examples
Examples
Every example below lives in estoria-examples as a self-contained Go module.
Backend Quickstarts
| Quickstart | What it Covers |
|---|---|
| PostgreSQL | Postgres event store, including the transactional outbox for reliable event delivery to external consumers. |
| MongoDB | MongoDB event store using a single-collection strategy. |
| KurrentDB | KurrentDB (formerly EventStoreDB) event store with native stream mapping. |
| OpenTelemetry | Instrumenting event, aggregate, and snapshot stores with OTEL tracing and metrics, against Jaeger, Prometheus, and Grafana. See Telemetry. |
Demo Applications
Runnable apps with web UIs, showcasing Estoria’s event sourcing features and capabilities.
| Example | What it Demonstrates | Try It |
|---|---|---|
| Kanban | A real-time collaborative board with a time-travel slider, live sync over SSE, optimistic concurrency surfaced in the UI, and snapshotting. SQLite — no Docker required. | |
| Orders | An order-fulfillment service: a strict state-machine domain, the transactional outbox delivering events to a CQRS read model and webhook log, and a live admin dashboard. Postgres. | orders.demo.estoria.dev |
| Fleet | An IoT sensor-fleet dashboard with an in-process device simulator: long streams, the full snapshotting and caching decorator stack, and a live hydration benchmark. SQLite. | |
| Chess | Two-player chess where each game is an event stream: move legality enforced inside ApplyTo, a replay slider, optimistic concurrency as turn-race protection, and PGN export. SQLite. | chess.demo.estoria.dev |
| Inspector | A read-only web tool for browsing any supported event store: stream lists, event paging, payload inspection, and a live global-feed tail. |
Concepts
| Concepts | Read | In the Code |
|---|---|---|
Entities, events, and ApplyTo | Defining Entities, Defining Events | kanban/board.go, kanban/board_events.go |
| Optimistic concurrency and version conflicts | Aggregate Store | kanban/server.go (runCommand), chess/server.go |
| Loading an aggregate at a past version | Event-Sourced Aggregate Store | kanban/server.go, chess/server.go |
| Snapshotting on a policy | Snapshotting Aggregate Store, Snapshot Store | kanban/main.go, fleet/main.go |
| Hooks reacting to a save | Hookable Aggregate Store | kanban/main.go (SSE broadcast on AfterSave) |
| Aggregate caching, and what it’s worth | Cached Aggregate Store, Aggregate Cache | fleet/main.go, plus the hydration benchmark in fleet/server.go |
| Projections over a stream | Projections | kanban/server.go (activity feed) |
| CQRS with a read model | CQRS | orders/readmodel.go |
| The transactional outbox | CQRS | orders/main.go, orders/readmodel.go |
| Reading an event store directly | Event Store | inspector/backend.go |