Skip to content

EventFlowWhere Business Logic Speaks Human

Design state machines collaboratively. Write them in natural language. Execute, test, and visualize from a single source of truth.

EventFlow

Quick Example โ€‹

flow
machine: @order

scenario: checkout

  given:
    @customer is logged in
    cart has items

  on> :checkout from @customer
    ? cart is valid
      emit :payment_request to @payment
      order moves to #awaiting_payment

    expect:
      = order is in #awaiting_payment

  on :payment_success from @payment
    send confirmation email
    order moves to #confirmed

  expect:
    = order is in #confirmed
    = @customer received :confirmation
flow
test: @order

  for scenario: checkout

    for :checkout:
      empty cart rejected:
        with scenario:
          cart is empty
        = @customer received :error

      payment declined:
        assume:
          ? payment successful = false
        = order is in #payment_failed

    payment fails then retries:
      after :checkout
      receive :payment_failed from @payment
      then :payment_success from @payment
      = order is in #confirmed

Released under the MIT License.