Get Started
From zero to generated artifacts in minutes. By the end of this guide,
you'll have typed TypeScript, test scaffolds, Gherkin features, spec documents,
and AsyncAPI contracts — all from a single .moment file.
Before you begin
Node.js 20+ Required runtime
pnpm 10+ Package manager (Moment uses pnpm workspaces)
TypeScript 5.8+ For generated type artifacts
1
Clone and build
Moment is distributed as a monorepo. Clone it and build all packages.
git clone https://github.com/mmmnt/mmmnt.git
cd mmmnt
pnpm install
pnpm turbo build 2
Write your first specification
Create a .moment file describing your domain. Here's a minimal example
with one bounded context, an aggregate, a command, and an event.
shop.moment
context "Shop" [Core]
aggregate "Product"
identity productId: UUID
command CreateProduct
input name: string, price: Money
precondition nameNotEmpty: "Name must not be empty"
emits ProductCreated
event ProductCreated
productId: UUID
name: string
price: Money
createdAt: DateTime
value-object Money
amount: number
currency: string
invariant SHOP-01 "Product name must not be empty"
scope Product 3
Parse and generate
Run the Moment CLI to parse your specification, derive test topologies, and generate all artifacts.
# Parse the specification into IR
moment parse shop.moment
# Derive test topologies and scenarios
moment derive
# Generate all output artifacts
moment generate --all
# Or run everything in watch mode
moment watch shop.moment 4
Explore what was generated
Moment produces several artifact types from your specification:
- TypeScript interfaces — Discriminated union types, readonly fields, and aggregate classes ready for implementation
- Test scaffolds — Pre-populated
.spec.tsfiles with types, setup steps, and assertion stubs - Gherkin features — BDD scenarios covering every command, event, precondition, and invariant
- Spec documents — Markdown with Mermaid diagrams for living documentation
- AsyncAPI contracts — Event-driven API documentation
5
CLI command highlights
Moment ships with 20+ CLI commands. Here are the ones you'll use most.
moment parse <file> Parse a .moment file into Intermediate Representation moment derive Derive test topologies, scenarios, and impact catalogs moment generate --all Generate Gherkin, spec docs, TypeScript, and test scaffolds moment watch <file> Watch for changes and auto-regenerate artifacts moment drift Detect implementation drift from specification moment reconcile Reconcile specification with implementation changes