-
Notifications
You must be signed in to change notification settings - Fork 0
Why Moment
Every software team faces the same expensive risk: you don't know your domain design is wrong until you've built it.
Traditional development flows discovery → design → implementation → testing → "oh, the event schema doesn't work" → rework. The feedback loop is measured in weeks. By the time you discover that your OrderPlaced event is missing the shipping address, or that the fulfillment context can't consume the inventory event, you've already written thousands of lines of code around the wrong contract.
Domain-Driven Design promised to solve this. But in practice, DDD artifacts stay in Miro boards and wiki pages. The bounded context map is a diagram, not a testable specification. The event storming output is sticky notes, not machine-readable contracts. There's no feedback loop between the design and the code.
Moment is a specification-first domain modeling tool. You describe your domain in .moment files — bounded contexts, aggregates, commands, events, value objects, invariants, policies, sagas, and temporal flows — and Moment generates testable artifacts from that specification.
| Artifact | Purpose |
|---|---|
| TypeScript interfaces | Type-safe contracts for every aggregate, command, event, and value object |
Test scaffolds (.spec.ts) |
Per-aggregate and per-flow test structure with assertion points |
Gherkin features (.feature) |
BDD scenarios derived from temporal flows with contract assertions |
| Specification documents | Markdown documentation of context inventories and relationships |
| Visualization envelope | JSON data for rendering context maps and temporal timelines |
| Simulation scenarios | Facet-compatible event chains with causation, payloads, and expected paths |
| Drift reports | Detect when implementation diverges from specification |
This isn't documentation generation. Every artifact Moment produces is executable against your domain.
-
Schema contracts are locked. The TypeScript interfaces define exactly what
OrderPlacedcontains. Every consumer of that event codes against the same contract. -
Crossing contracts are validated. When
OrderPlacedcrosses from Ordering to Fulfillment, thecrosses-tocontract specifies exactly which fields are[required]. If Fulfillment needsshippingAddressand it's not in the contract, you know now, not after deployment. -
Temporal sequences are simulated.
moment simulatewalks the entire flow — check-in → triage → diagnosis → treatment → billing → discharge — producing a 28-event chain with causation IDs, branch decisions, and payload data. -
Branch paths are enumerated. Every
[branch]moment withwhenblocks produces test cases for each path — all derived from the specification, all testable.
Moment produces the specification artifacts. Facet consumes them and runs the full domain simulation.
.moment file
→ Moment CLI
→ Simulation Scenario (JSON)
→ Facet Simulation Engine
→ Event-by-event execution
→ Pass/fail per scenario
→ Visualization dashboard
Facet takes Moment's simulation output and:
- Walks the expected path node by node
- Evaluates branch decisions with the specified conditions
- Validates event payloads against schema contracts
- Tracks causation chains — does each event correctly reference its cause?
- Reports pass/fail per scenario with precise divergence points
- Visualizes results — which moments passed, which failed, where the flow broke
Before Moment + Facet: "We think the domain works" → build for months → discover contract mismatches → expensive rework.
After Moment + Facet: "We know the domain works" → test every temporal path → validate every schema crossing → implement with confidence.
The .moment file is the single source of truth. Change the specification, regenerate, re-simulate. The feedback loop is seconds, not weeks.
- Domain architects who model bounded contexts and need testable specifications
- Engineering teams who want type-safe contracts before implementation begins
- QA teams who need Gherkin scenarios derived from the domain, not invented from tickets
- Platform teams who need to validate event schemas across service boundaries
| Traditional DDD Tooling | Moment |
|---|---|
| Diagrams in Miro/Lucidchart | Machine-readable .moment specs |
| Sticky notes from event storming | Formal event declarations with typed fields |
| Context maps as pictures | Executable crossing contracts with [required] fields |
| Manual test creation | Auto-derived test suites from temporal flows |
| No schema validation |
moment sync status detects drift |
| No simulation |
moment simulate produces full event chains |
| Design docs rot |
moment generate regenerates from source of truth |