keiro: Event sourcing framework and workflow engine

[ bsd3, control, library ] [ Propose Tags ] [ Report a vulnerability ]
Versions [RSS] 0.2.0.0
Change log CHANGELOG.md
Dependencies aeson (>=2.2), aeson-casing (>=0.2), base (>=4.21 && <5), bytestring (>=0.11), containers (>=0.6), contravariant-extras (>=0.3), deepseq (>=1.5), effectful (>=2.6), effectful-core (>=2.6), generic-lens (>=2.2), hasql (>=1.10), hasql-pool (>=1.2), hasql-transaction (>=1.1), hs-opentelemetry-api (>=1.0 && <1.1), hs-opentelemetry-propagator-w3c (>=1.0 && <1.1), hs-opentelemetry-semantic-conventions (>=1.40 && <2), keiki (>=0.2 && <0.3), keiki-codec-json (>=0.2 && <0.3), keiro-core (>=0.2.0.0 && <0.3), kiroku-store (>=0.3 && <0.4), lens (>=5.2), mmzk-typeid (>=0.7), scientific (>=0.3), shibuya-core (>=0.8.0.1 && <0.9), stm (>=2.5), streamly (>=0.11), streamly-core (>=0.3), text (>=2.1), time (>=1.12), unliftio-core (>=0.2), uuid (>=1.3), vector (>=0.13) [details]
Tested with ghc >=9.12 && <9.13
License BSD-3-Clause
Copyright 2026 Nadeem Bitar
Author Nadeem Bitar
Maintainer nadeem@gmail.com
Uploaded by shinzui at 2026-07-14T04:37:13Z
Category Control
Home page https://github.com/shinzui/keiro#readme
Bug tracker https://github.com/shinzui/keiro/issues
Source repo head: git clone https://github.com/shinzui/keiro.git
Distributions
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed as of 2026-07-14 [all 1 reports]

Readme for keiro-0.2.0.0

[back to package description]

keiro — 経路

keiro is a Haskell library for event sourcing and workflow orchestration. It combines an append-only event store, a pure functional state machine, and subscription workers into one library-shaped runtime that an application imports and runs against PostgreSQL.

The name

経路 (keiro) means route, path, or course in Japanese: the way something travels from an origin to a destination.

Kanji Reading Meaning
kei to pass through, to elapse, a way, a longitude
ro a road, path, or way

The name is literal. keiro is about the paths events take through a system:

  • an event stream is the route an aggregate's history has taken;
  • a subscription follows the route through the global event log;
  • a projection routes events into queryable read models;
  • a process manager routes source events into commands for another stream;
  • a workflow is a durable route through state, timers, and external effects.

The sibling project keiki (継起, "successive occurrence") names the succession of events. keiro names the routes those events travel and the routes downstream processes follow.

What it provides

The current v1 library provides:

  • typed stream names through Keiro.Stream;
  • event codecs, schema versions, event type validation, and upcasters through Keiro.Codec;
  • the author-facing EventStream contract in Keiro.EventStream;
  • runCommand and runCommandWithSql in Keiro.Command for the canonical load, streaming replay, decide, append-event-batch cycle with optimistic concurrency;
  • advisory snapshots in Keiro.Snapshot;
  • read models, inline projections, async projection helpers, and rebuild metadata in Keiro.ReadModel and Keiro.Projection;
  • event-sourced process managers in Keiro.ProcessManager;
  • durable timer storage and workers in Keiro.Timer.

The stable contracts used by future Keiro packages live in the sibling keiro-core package. The full keiro package depends on keiro-core and re-exports those core modules, so existing imports such as Keiro.Codec, Keiro.EventStream, Keiro.Stream, and Keiro.Integration.Event continue to work for applications that depend on keiro.

The top-level Keiro module re-exports the core stream, codec, event-stream, command, and snapshot APIs. Read-model, projection, process-manager, and timer modules are exposed directly so applications can import them explicitly.

Runtime stack

keiro is not a server. The keiro-core package contains reusable contracts and pure helpers; the keiro package adds the runtime that composes these dependencies:

  • kiroku for the PostgreSQL-backed append-only event store;
  • keiki for the pure SymTransducer state-machine core;
  • shibuya for subscription and worker supervision;
  • hasql and effectful for database access and effect handling;
  • Streamly for streaming reads and worker loops.

Development

From the repository root:

cabal build all
cabal test all
cabal test jitsurei-test
just haskell-verify

The package metadata lives in keiro/keiro.cabal. The implementation plans and design history live under docs/masterplans/, docs/plans/, and docs/research/. User-facing documentation starts at docs/user/README.md. Long-form, guide-backed examples start at docs/guides/README.md and use the sibling jitsurei package as their executable source.

Status

The v1 implementation MasterPlan is complete. The library currently includes the package scaffold, public EventStream and codec contract, command cycle, snapshots, read models and projections, process managers, and durable timer APIs.

Remaining work is future-facing: the v2 deterministic durable-execution runtime, exactly-once async projection checkpoint/user-SQL transactions once shibuya exposes that boundary, and higher-level ergonomic facades over the low-level v1 APIs.

License

BSD-3-Clause.