Examples

Real specs, and the flows they render.

Each example is a complete .moment file beside the Facet flow it compiles into. The diagram is a build artifact of the spec — never drawn by hand.

01 · Commerce

Order → Fulfillment crossing

order.moment
context "Ordering" [Core]
  event OrderPlaced
    orderId: UUID
    items: LineItem[]

context "Fulfillment" [Supporting]
  command InitiateFulfillment

flow "order-placed"
  moment "Submission"
    ordering: OrderPlaced
      crosses-to fulfillment
        via CustomerSupplier
        contract { orderId, items }
      triggers InitiateFulfillment
facet · order-placed 3/3 contracts
Ordering Fulfillment OrderPlaced crosses-to · CustomerSupplier { orderId, items } InitiateFulfillment
02 · Payments

A saga with compensation

payment.moment
context "Payments" [Core]
  event PaymentAuthorized
  event PaymentCaptured
  event PaymentRefunded

flow "settlement"
  saga "capture-or-refund"
    moment "Authorize"
      payments: PaymentAuthorized
        triggers CapturePayment
    until PaymentCaptured
        | PaymentRefunded
facet · settlement terminal reached
Authorized CapturePayment PaymentCaptured PaymentRefunded until — either terminal
03 · Onboarding

A crossing across three contexts

onboarding.moment
flow "customer-onboarding"
  moment "SignUp"
    identity: AccountCreated
      crosses-to billing
        contract { accountId, plan }
  moment "Provision"
    billing: SubscriptionStarted
      crosses-to workspace
        contract { accountId, seats }
      triggers ProvisionWorkspace
facet · customer-onboarding 2 crossings ok
Identity Billing Workspace AccountCreated SubStarted ProvisionWS

Write your own.

Every one of these is a plain .moment file. Clone the repo and render your first flow in minutes.

Get started Learn the DSL →