Experimental Livebook-friendly DSL for sketching DDD domain models.
This Lab DSL compiles to the stable, pipe-first Choreo.Domain builders and
returns an ordinary %Choreo.Domain{}. It supports strategic context maps,
tactical event-storming flows, Wlaschin-style workflow/type sketches, and named
scenarios for Event Modeling projections.
Examples
iex> import Choreo.Lab.DSL.Domain
...> model = domain do
...> checkout = context_boundary("Checkout")
...> customer = actor("Customer")
...> place_order = command("Place Order", cluster: checkout)
...> order = aggregate("Order", cluster: checkout, invariants: ["Cannot place an empty order."])
...> placed = event("Order Placed", cluster: checkout)
...> summary = read_model("Order Summary", cluster: checkout)
...>
...> customer ~> place_order |> initiates("starts")
...> place_order ~> order |> handles("validates")
...> order ~> placed |> emits("records")
...> placed ~> summary |> projects_to("updates")
...> end
iex> Choreo.Domain.nodes(model).order.type
:aggregateStrategic context maps can use context nodes and context-mapping relationships:
ordering = context("Ordering", subdomain: :core)
billing = context("Billing", subdomain: :supporting)
customer_supplier ordering ~> billing, "Invoice requests"Tactical edges can use generic, typed, or pipe-modified forms:
actor ~> command |> initiates("submits")
command ~> aggregate |> handles("validates")
aggregate ~> event |> emits("records")
event ~> policy |> triggers("reacts")
event ~> read_model |> projects_to("updates")
edge upstream ~> downstream, translates_via: "ACL"
Summary
Functions
Builds a %Choreo.Domain{} from a compact Lab DSL block.
Returns the vocabulary supported by the domain DSL.
Compatibility alias for taxonomy/0.
Types
@type edge_decl() :: %{ from: Yog.node_id(), to: Yog.node_id(), opts: keyword(), builder: atom() }
@type node_decl() :: %{id: Yog.node_id(), builder: atom(), opts: keyword()}
Functions
Builds a %Choreo.Domain{} from a compact Lab DSL block.
@spec taxonomy() :: %{ clusters: [atom()], nodes: [atom()], edges: [atom()], events: [atom()], modifiers: [atom()], options: [atom()] }
Returns the vocabulary supported by the domain DSL.
iex> taxonomy = Choreo.Lab.DSL.Domain.taxonomy()
iex> :aggregate in taxonomy.nodes
true
iex> :context_boundary in taxonomy.clusters
true
iex> :emits in taxonomy.edges
true
@spec verbs() :: map()
Compatibility alias for taxonomy/0.