Choreo.Render.Architecture (Choreo v0.11.0)

Copy Markdown View Source

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 typeArchitecture icon
:internetinternet
:databasedatabase
:managed_dbdatabase
:cachedatabase
:storagedisk
:networkcloud
:serviceserver
:computeserver
:load_balancerserver
:queueserver
:userserver
:genericserver

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

Summary

Functions

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

Functions

to_mermaid(system, opts \\ [])

@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.