Capabilities

Sagas & Workflows

Long-running processes as first-class citizens: sagas, declarative state machines, and routing slips with compensation.

Some operations aren’t one transaction — they’re a process: reserve inventory, capture payment, arrange shipping, and undo the right steps in the right order when step four fails. Modeling that as flags on a row ends in impossible states; Relay models it explicitly.

What ships: imperative Saga<TState> process managers with durable state, the declarative StateMachineSaga<TState> DSL (states, events, transitions — impossible states become unrepresentable), routing slips with LIFO compensation for distributed transactions without 2PC, and standalone courier activities for reusable, auditable units of work (the principled version of the “undo money” script).

The stories behind it: The Order That Got Stuck Forever, The Onboarding That Got Lost in If-Statements, and The Transfer That Needed Undoing.

Learn by building

The tutorials for this area, in order — each with a runnable sample.