# `Spectre.GAM.Domain`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gam/domain.ex#L1)

Runtime handle for one governed Domain.

The handle is deliberately not a durable record. Authority lives in the
Domain ledger; the pid merely serializes commands against that ledger. Each
running Domain is wired to one validated `Spectre.GAM.Ingress` adapter, whose
stable reference fences every authenticated submission context.

Public workflows enter through `Spectre.GAM`; `Domain.Sequencer` is the ordered
mailbox, and the modules below `Domain.Command` own the individual I/O
workflows. Governed semantics do not live in this handle or in callbacks:
they are evaluated by `Spectre.GAM.Kernel` and replayed by
`Spectre.GAM.GovernedAct.Fold`.

For a static application topology, put `{Spectre.GAM.Domain, opts}` after its
store in the host supervisor. `opts` includes `:domain_ref`, `:store` and the
same foundation/boundary options accepted by `Spectre.GAM.start_domain/3`.
`:rest_for_one` restarts the Domain after an earlier store child fails; the
store's own durability determines what survives. Resolve the registered
handle with `Spectre.GAM.lookup_domain/1` after startup. The default Registry is
provided by the Spectre.GAM application.

Use `Spectre.GAM.start_domain/3` for dynamically provisioned Domains under
Spectre.GAM's supervisor instead. Do not start the same Domain in both trees.
Neither form authenticates a Scope or creates an Instance automatically.

# `t`

```elixir
@type t() :: %Spectre.GAM.Domain{ref: String.t(), server: GenServer.server()}
```

Transparent runtime address, not proof of identity or authority.

Callers and facade workflows may inspect this data. Governed operations
resolve the registered Domain and verify the submission context; neither
constructing nor editing a handle bypasses those checks.

# `child_spec`

```elixir
@spec child_spec(keyword()) :: Supervisor.child_spec()
```

Declares one Domain as a permanent, uniquely identified child of a host supervisor.

# `handle`

```elixir
@spec handle(GenServer.server(), String.t()) :: t()
```

Constructs a runtime address; it does not verify that the process owns this Domain or grant access.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts and registers a Domain linked to the caller, with explicit foundation and adapter options.

# `whereis`

```elixir
@spec whereis(String.t(), atom()) :: pid() | nil
```

Returns the locally supervised process for a Domain reference.

---

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