Skip to content

Proposal: EventFlow Lane Diagrams

Status: Draft - For Discussion

Inspiration: BPMN Sketch Miner

BPMN Sketch Miner uses a text-based approach where each line becomes a diagram element. We adapt this for EventFlow with our symbol system.


Example: E-commerce Checkout with Guards and Actions

@customer@order@payment@shipping:checkout?customer is logged in:login_required?cart is not empty:empty_cart$order_id = uuid()$total = calculate():request_payment($order_id, $total)(processing)?:payment_complete:payment_failedsend confirmation email:order_confirmed:ship_order($order_id, $address)(preparing):shipped:shipment_notification:delivered:delivery_confirmedLegendtrigger:event?guard$x = yactionsuccesserror

Corresponding EventFlow Code

eventflow
machine: @order

@customer
>on :checkout
  ? customer is logged in
    :login_required -> @customer
  ? cart is not empty
    :empty_cart -> @customer

  $order_id = uuid()
  $total = calculate()

  :request_payment -> @payment ($order_id, $total)

@payment
on :request_payment
  ? payment successful
    :payment_complete -> @order
  ?
    :payment_failed -> @order

@order
on :payment_complete
  send confirmation email
  :order_confirmed -> @customer
  :ship_order -> @shipping ($order_id, $address)

@shipping
on :ship_order
  (preparing)
  :shipped -> @order

@order
on :shipped
  :shipment_notification -> @customer

on :delivered
  :delivery_confirmed -> @customer

Visual Elements Mapping

EventFlowDiagram Element
@actorLane (column)
:eventArrow with label
>on :eventTrigger dot + arrow (API)
on :eventArrow (internal)
? conditionDiamond with ?
$var = valueBox with assignment
-> @actorArrow to actor's lane
SuccessGreen arrow
Error/rejectionRed arrow

Alternative: Flow Chart Style (No Lanes)

A simpler view without actor lanes - just the flow of events, guards, and actions. Actors shown as labels on events.

:checkout@customer → @order?logged in:login_required→ @customer?cart ok:empty_cart→ @customer$order_id = uuid()$total = calculate():request_payment@order → @payment?paid:payment_complete@payment → @ordersend confirmation email+:order_confirmed@order → @customer:ship_order@order → @shipping:shipped@shipping → @orderLegend:eventEvent?Guard+ParallelAction

Key Benefits

  1. All elements visible - Guards, actions, events in one diagram
  2. Flow is clear - Top to bottom, left to right for responses
  3. Matches code - Diagram structure mirrors .flow file structure
  4. Team readable - Non-developers can follow the logic

Released under the MIT License.