What is EventFlow?
EventFlow is a natural language DSL where the documentation you write IS the executable state machine. There is no code generation step - the .flow files are directly interpreted at runtime.
The Core Idea
flow
machine: @order
scenario: complete purchase
on> :checkout from @customer
? cart is not empty
order moves to #awaiting_payment
emit :payment_request to @payment
on :payment_success from @payment
order moves to #paid
expect:
= order is in #paidThis is not pseudocode. This runs.
One File, Three Outputs
Every .flow file serves as a single source of truth that produces:
- Runtime: Your state machine executes exactly as written
- Tests: Every scenario with assertions is an executable test
- Diagrams: Visualizations are auto-generated from the same source
Zero drift. Always in sync.
Who Uses EventFlow?
EventFlow brings together different roles in collaborative sessions:
| Role | How They Use EventFlow |
|---|---|
| Product Managers | Define business flows and validate logic |
| Developers | Implement bindings and maintain runtime |
| Designers | Understand user journeys and states |
| QA Engineers | Write test scenarios and verify behavior |
From Event Storming to Running Code
Traditional workflow:
EventFlow workflow:
Core Concepts at a Glance
Machines are Actors
Every machine is an actor that:
- Has its own state
- Listens for events
- Emits events to other machines
- Manages its own context (data)
flow
machine: @order // Actor definitionScenarios are Features
A scenario groups related event handlers that together form a business capability:
flow
scenario: checkout flow
on> :checkout from @customer // Event 1
...
on :payment_success // Event 2
...Events Drive Everything
Every state transition is triggered by an event:
flow
on> :checkout from @customer // External event (API)
order moves to #awaiting_payment
on :payment_success from @payment // Internal event
order moves to #paidNatural Language Syntax
EventFlow reads like English:
flow
? cart is not empty // Guard (condition)
$total increases by $item.price // Action
order moves to #processing // State transition
emit :notification to @admin // Event emission