Skip to content

Examples

Every example below lives in estoria-examples as a self-contained Go module.

Backend Quickstarts

QuickstartWhat it Covers
PostgreSQLPostgres event store, including the transactional outbox for reliable event delivery to external consumers.
MongoDBMongoDB event store using a single-collection strategy.
KurrentDBKurrentDB (formerly EventStoreDB) event store with native stream mapping.
OpenTelemetryInstrumenting 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.

ExampleWhat it DemonstratesTry It
KanbanA 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.
OrdersAn 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
FleetAn 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.
ChessTwo-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
InspectorA read-only web tool for browsing any supported event store: stream lists, event paging, payload inspection, and a live global-feed tail.

Concepts

ConceptsReadIn the Code
Entities, events, and ApplyToDefining Entities, Defining Eventskanban/board.go, kanban/board_events.go
Optimistic concurrency and version conflictsAggregate Storekanban/server.go (runCommand), chess/server.go
Loading an aggregate at a past versionEvent-Sourced Aggregate Storekanban/server.go, chess/server.go
Snapshotting on a policySnapshotting Aggregate Store, Snapshot Storekanban/main.go, fleet/main.go
Hooks reacting to a saveHookable Aggregate Storekanban/main.go (SSE broadcast on AfterSave)
Aggregate caching, and what it’s worthCached Aggregate Store, Aggregate Cachefleet/main.go, plus the hydration benchmark in fleet/server.go
Projections over a streamProjectionskanban/server.go (activity feed)
CQRS with a read modelCQRSorders/readmodel.go
The transactional outboxCQRSorders/main.go, orders/readmodel.go
Reading an event store directlyEvent Storeinspector/backend.go