Skip to content

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 #paid

This is not pseudocode. This runs.

One File, Three Outputs

Every .flow file serves as a single source of truth that produces:

order.flowRuntimeTestsDiagrams
  • 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:

RoleHow They Use EventFlow
Product ManagersDefine business flows and validate logic
DevelopersImplement bindings and maintain runtime
DesignersUnderstand user journeys and states
QA EngineersWrite test scenarios and verify behavior

From Event Storming to Running Code

Traditional workflow:

StormingDocs(drifts)Code(diverges)Tests(outdated)Docs(forgotten)

EventFlow workflow:

Storming.flow fileDocsTestsRuntime(always in sync)

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 definition

Scenarios 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 #paid

Natural 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

Released under the MIT License.