# `Choreo.Lab.DSL.Domain`
[🔗](https://github.com/code-shoily/choreo/blob/v0.14.1/lib/choreo/lab/dsl/domain.ex#L1)

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
    :aggregate

Strategic 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"

# `cluster_decl`

```elixir
@type cluster_decl() :: %{id: String.t(), builder: atom(), opts: keyword()}
```

# `edge_decl`

```elixir
@type edge_decl() :: %{
  from: Yog.node_id(),
  to: Yog.node_id(),
  opts: keyword(),
  builder: atom()
}
```

# `node_decl`

```elixir
@type node_decl() :: %{id: Yog.node_id(), builder: atom(), opts: keyword()}
```

# `scenario_decl`

```elixir
@type scenario_decl() :: %{name: atom(), opts: keyword()}
```

# `acl`

# `actor`

# `aggregate`

# `anti_corruption`

# `anti_corruption_layer`

# `boundary`

# `bounded_context`

# `command`

# `conformist`

# `connects`

# `context`

# `context_boundary`

# `context_cluster`

# `customer_supplier`

# `data_type`

# `domain`
*macro* 

Builds a `%Choreo.Domain{}` from a compact Lab DSL block.

# `domain`
*macro* 

# `domain_event`

# `edge`

# `emits`

# `entity`

# `event`

# `external`

# `external_system`

# `handles`

# `initiates`

# `notifies`

# `on`

# `open_host_service`

# `policy`

# `process`

# `projection`

# `projects_to`

# `published_language`

# `read_model`

# `saga`

# `scenario`

# `shared_kernel`

# `taxonomy`

```elixir
@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

# `translates_via`

# `triggers`

# `type`

# `user`

# `verbs`

```elixir
@spec verbs() :: map()
```

Compatibility alias for `taxonomy/0`.

# `workflow`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
