Event Modeling in YAML
Emlang is a text-based DSL for Event Modeling that lets you write event models in YAML. It's also a complete toolchain that validates syntax and generates HTML diagrams.
Event Modeling traditionally uses walls and visual tools for collaborative workshops. Emlang complements these practices by letting you maintain models as code—useful for documenting existing systems, writing normalized specs, or when text-based workflows fit better. See the language specification for the full syntax.
slices:
User registration:
steps:
- t: Customer / Registration form # trigger on the Customer swimlane
- c: Register user # command
props: # free-form properties
email: string
password: string
- e: User / User registered # event on the User swimlane
props:
userId: uuid
email: string
registeredAt: datetime
- v: User profile # view (read model)
tests:
Email must be unique: # Given-When-Then test
given:
- e: User / User registered
props:
email: joe@example.com
when:
- c: Register user
props:
email: joe@example.com
then:
- x: Email already in use # exception
slices:
Invoice generation: # processor pattern (direct form, no tests)
- e: Shipping / Order shipped
- v: Pending invoices
- t: Invoice generation process
- c: Generate invoice
props:
orderId: uuid
customerId: uuid
- e: Billing / Invoice generated
props:
invoiceId: uuid
amount: decimal
generatedAt: datetime
- v: Pending invoices
slices:
Order flow: # just events, no commands yet
- e: Order placed
- e: Payment received
- e: Items reserved
- e: Shipment scheduled
- e: Order shipped
- e: Order delivered
- e: Feedback requested
- e: Order completed
Install with Go:
Or download a precompiled binary from the releases page.
Generate your first diagram:
See the CLI Reference for the full list of commands and options.