Learn the essentials of SEA™ DSL and write your first domain model.
Every SEA™ DSL file follows this structure:
@namespace "com.example.domain" # Scope declarations
@version "1.0.0" # File version
import * as Std from "std:core" # Optional imports
Entity "Name" in domain # Declarations
Resource "Thing" units in domain
Flow "Action" from "A" to "B"
Policy rule as: (expression)
Domain concepts—things that exist:
Entity "Customer" in sales
Entity "Order" in orders
Entity "Product" in catalog
Things that flow between entities:
Resource "Money" USD in finance
Resource "Token" units in auth
Resource "OrderItem" units in orders
Movement or transformation between entities:
Flow "Payment"
@cqrs { "kind": "command" }
@tx { "transactional": true }
from "Customer" to "Vendor" quantity 100
CRITICAL: Every Flow requires @cqrs annotation!
Business rules and constraints:
Policy no_negative_amount
per Constraint Prohibition priority 10
@rationale "Amounts cannot be negative"
as: (amount >= 0)
| Annotation | Required On | Example |
|---|---|---|
@cqrs |
Every Flow | @cqrs { "kind": "command" } |
@namespace |
File | @namespace "com.example.sales" |
# Command - changes state
Flow "CreateOrder" @cqrs { "kind": "command" }
# Query - reads state
Flow "GetOrders" @cqrs { "kind": "query" }
# Event - notification
Flow "OrderCreated" @cqrs { "kind": "event" }
@namespace "com.example.ecommerce"
@version "1.0.0"
// Entities
Entity "Customer" in ecommerce
Entity "Order" in ecommerce
Entity "Inventory" in ecommerce
// Resources
Resource "Money" USD in ecommerce
Resource "OrderItem" units in ecommerce
// Flows
Flow "PlaceOrder"
@cqrs { "kind": "command" }
@tx { "transactional": true }
@idempotency { "enabled": true, "key": "orderId" }
from "Customer" to "Order" quantity 1
Flow "ProcessPayment"
@cqrs { "kind": "command" }
@tx { "transactional": true }
from "Customer" to "Inventory"
Flow "OrderPlaced"
@cqrs { "kind": "event" }
@outbox { "mode": "required" }
from "Order" to "EventBus"
// Policies
Policy order_requires_payment
per Constraint Obligation priority 10
@rationale "Orders must be paid before fulfillment"
as: forall o in flows where o.name = "PlaceOrder":
exists p in flows where p.name = "ProcessPayment"
1
2
3
4
5
6
7
8
# Validate syntax
just sea-validate docs/specs/ecommerce/ecommerce.sea
# Parse to AST
just sea-parse docs/specs/ecommerce/ecommerce.sea
# Lint for @cqrs
python tools/flow_lint.py --strict docs/specs/ecommerce/ecommerce.sea
Last Updated: January 2026