# `Choreo.Render.Architecture`
[🔗](https://github.com/code-shoily/choreo/blob/v0.14.1/lib/choreo/render/architecture.ex#L1)

Renders a `Choreo` struct to Mermaid.js `architecture-beta` syntax.

`architecture-beta` is Mermaid's dedicated diagram type for cloud and
service topologies. It uses built-in icons (cloud, database, disk, internet,
server) and `group` boundaries instead of arbitrary shapes and colours.

## Mapping from Choreo

| Choreo node type | Architecture icon |
| ---------------- | ----------------- |
| `:internet`      | `internet`        |
| `:database`      | `database`        |
| `:managed_db`    | `database`        |
| `:cache`         | `database`        |
| `:storage`       | `disk`            |
| `:network`       | `cloud`           |
| `:service`       | `server`          |
| `:compute`       | `server`          |
| `:load_balancer` | `server`          |
| `:queue`         | `server`          |
| `:user`          | `server`          |
| `:generic`       | `server`          |

Choreo clusters become `group` declarations. Nested clusters are emitted
with the `in` keyword.

## Limitations

The `architecture-beta` syntax does not support edge labels, protocols, or
per-node styling. Those attributes are intentionally omitted from the
rendered output.

Labels are sanitized to the character set supported by Mermaid
(`[a-zA-Z0-9_ ]`); hyphens and slashes become spaces and other punctuation
is removed.

## Examples

    system =
      Choreo.new()
      |> Choreo.add_service(:api, label: "API")
      |> Choreo.add_database(:db, label: "Postgres")
      |> Choreo.connect(:api, :db)

    Choreo.Render.Architecture.to_mermaid(system)
    # => "architecture-beta\n  service api(server)[API]\n  ..."

# `to_mermaid`

```elixir
@spec to_mermaid(Choreo.t(), keyword()) :: String.t()
```

Renders a `Choreo` system diagram to Mermaid.js `architecture-beta` syntax.

## Options

  * `:direction` — accepted for API compatibility but ignored; architecture
    diagrams use a force-directed layout.
  * `:theme` — accepted for API compatibility but ignored; architecture
    diagrams rely on global Mermaid themes.

---

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