The .moment DSL

A domain-specific language for temporal domains.

A Langium grammar. Reads like a domain description, compiles to a typed intermediate representation, and drives every downstream artifact. Learn the whole language below — drag the seam, or tap any keyword.

Read it two ways

The same file, as grammar and as a real spec.

drag the seam · or tap a keyword
order.moment
grammar | spec
context "Ordering" [Core]
aggregate "Order"
command PlaceOrder
emits OrderPlaced
event OrderPlaced
orderId: UUID
items: LineItem[]
placedAt: DateTime
context "Fulfillment" [Supporting]
aggregate "Shipment"
command InitiateFulfillment
flow "order-placed"
moment "Submission"
ordering: OrderPlaced
crosses-to fulfillment
via CustomerSupplier
contract { orderId, items }
triggers InitiateFulfillment
saga "fulfillment-lifecycle"
until ShipmentDelivered | OrderCancelled
context <"Subdomain"> [<Core|Supporting|Generic>]
aggregate <"Consistency-Boundary">
command <Actor-Intent>
emits <Resulting-Event>
event <Past-Tense-Fact>
<attribute>: <Type>
<attribute>: <Type[]>
<attribute>: <Type>
context <"Subdomain"> [<Core|Supporting|Generic>]
aggregate <"Consistency-Boundary">
command <Actor-Intent>
flow <"business-process">
moment <"pivotal-point">
<origin-context>: <Event>
crosses-to <downstream-context>
via <Context-Mapping>
contract { <published-language> }
triggers <Reactive-Command>
saga <"long-running-process">
until <Terminal-State> | <Terminal-State>
your spec
Structure meets time
The spatial map, threaded with time.

DDD maps your domain in space — bounded contexts and aggregates, the where. Event Storming lays domain events along a timeline, the when. A .moment file is where the two meet — drag the seam to morph the grammar into the real spec.

TIP Tap any keyword above — or any line in the code — for its DDD and Event Storming meaning.
Quick reference

The whole vocabulary, at a glance.

KeywordMeaningLayer
context [Role] Bounded context with a Core / Supporting / Generic tag. structure
aggregate Consistency boundary owning commands and events. structure
command · emits An intent that mutates state and emits one or more events. structure
event A typed, past-tense fact. Carries the fields listed under it. structure
flow · moment A named temporal sequence, made of behavioral assertions. temporal
crosses-to · via · contract A boundary crossing, its relationship, and the schema it carries. temporal
triggers Causation — an event causes a downstream command. temporal
saga · until Long-running orchestration with declared terminal states. temporal
One grammar, every artifact

The IR the parser produces drives all of this.

TypeScript types

Event and command interfaces, aggregate contracts, discriminated unions.

Test scaffolds

Topologies, negative cases, and saga state-machine checks.

Gherkin features

Human-readable .feature files per flow.

facet.json

Simulation scenarios that load straight into the Facet harness.

AsyncAPI 3.0

Channel and message contracts for every boundary crossing.

Specification docs

Markdown that never drifts, because it is generated, not written.

See real examples → Full grammar on the wiki →