# oshanz/phoenix_diagrams architecture

> Architecture diagram of the GitHub repository oshanz/phoenix_diagrams, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oshanz/phoenix_diagrams
- Repository: https://github.com/oshanz/phoenix_diagrams

## Overview

PhoenixDiagrams is a mountable Phoenix diagram catalog: users browse grouped Mermaid and PlantUML definitions, inspect source and rendered diagrams, and use client-side viewing tools. The documented workflow mounts a LiveView at a configured diagram directory; the sampled router shows that it also mounts a dedicated asset route. Client hooks cover rendering, navigation, and diagram actions. The README documents the catalog workflow and capabilities; source excerpts are limited, so internal server-side calls beyond the router are not inferred.

Main entry points: [`priv/static/phoenix_diagrams/bundle_entry.js`](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/bundle_entry.js) (Hook exports), [`lib/phoenix_diagrams/router.ex`](https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/router.ex) (Mount helper), [`priv/static/phoenix_diagrams/mermaid_hook.js`](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/mermaid_hook.js) (Mermaid rendering), [`priv/static/phoenix_diagrams/plantuml_hook.js`](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/plantuml_hook.js) (PlantUML rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Phoenix integration"]
  node_router["Mount helper<br/>[router.ex]"]
  node_root["Root layout<br/>[root_layout.ex]"]
  node_asset["Asset route<br/>[asset_plug.ex]"]
end

subgraph group_catalog["Diagram catalog"]
  node_live["Diagram LiveView<br/>[diagram_live.ex]"]
  node_loader["Definition loader<br/>[loader.ex]"]
  node_components["Catalog components"]
end

subgraph group_client["Browser experience"]
  node_bundle["Hook exports<br/>[bundle_entry.js]"]
  node_sidebar["Sidebar controls<br/>[sidebar_hook.js]"]
  node_zoom["Pan and zoom<br/>[zoom_hook.js]"]
  node_download["Image download<br/>[download_hook.js]"]
  node_copy["Source copying<br/>[copy_hook.js]"]
  node_share["Link sharing<br/>[share_hook.js]"]
  node_fullscreen["Fullscreen view<br/>[fullscreen_hook.js]"]
  node_highlight["Source highlighting<br/>[highlight_hook.js]"]
end

subgraph group_render["Diagram rendering"]
  node_mermaid["Mermaid rendering<br/>[mermaid_hook.js]"]
  node_plantuml["PlantUML rendering<br/>[plantuml_hook.js]"]
  node_mermaid_engine["Mermaid engine"]
  node_plantuml_engine["PlantUML engine"]
end

node_host(("Host Phoenix app"))
node_browser(("User browser"))

node_host -->|"mounts"| node_router
node_router -->|"routes to"| node_live
node_router -->|"configures layout"| node_root
node_router -->|"forwards assets"| node_asset
node_browser -->|"browses catalog"| node_live
node_bundle -->|"exports hook"| node_mermaid
node_bundle -->|"exports hook"| node_plantuml
node_bundle -->|"exports hook"| node_sidebar
node_bundle -->|"exports hook"| node_zoom
node_bundle -->|"exports hook"| node_download
node_bundle -->|"exports hook"| node_copy
node_bundle -->|"exports hook"| node_share
node_bundle -->|"exports hook"| node_fullscreen
node_bundle -->|"exports hook"| node_highlight
node_mermaid -->|"loads lazily"| node_mermaid_engine
node_plantuml -->|"loads lazily"| node_plantuml_engine

click node_router "https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/router.ex"
click node_live "https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/diagram_live.ex"
click node_loader "https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/loader.ex"
click node_components "https://github.com/oshanz/phoenix_diagrams/tree/main/lib/phoenix_diagrams/components"
click node_root "https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/root_layout.ex"
click node_asset "https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/asset_plug.ex"
click node_bundle "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/bundle_entry.js"
click node_mermaid "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/mermaid_hook.js"
click node_plantuml "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/plantuml_hook.js"
click node_sidebar "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/sidebar_hook.js"
click node_zoom "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/zoom_hook.js"
click node_download "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/download_hook.js"
click node_copy "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/copy_hook.js"
click node_share "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/share_hook.js"
click node_fullscreen "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/fullscreen_hook.js"
click node_highlight "https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/highlight_hook.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_router,node_root,node_asset,node_browser toneBlue
class node_live,node_loader,node_components toneAmber
class node_bundle,node_sidebar,node_zoom,node_download,node_copy,node_share,node_fullscreen,node_highlight toneMint
class node_mermaid,node_plantuml,node_mermaid_engine,node_plantuml_engine toneRose
class node_host toneIndigo
```

## Components

### Phoenix integration

- [Mount helper](https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/router.ex): `lib/phoenix_diagrams/router.ex`
- [Root layout](https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/root_layout.ex): `lib/phoenix_diagrams/root_layout.ex`
- [Asset route](https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/asset_plug.ex): `lib/phoenix_diagrams/asset_plug.ex`

### Diagram catalog

- [Diagram LiveView](https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/diagram_live.ex): `lib/phoenix_diagrams/diagram_live.ex`
- [Definition loader](https://github.com/oshanz/phoenix_diagrams/blob/main/lib/phoenix_diagrams/loader.ex): `lib/phoenix_diagrams/loader.ex`
- [Catalog components](https://github.com/oshanz/phoenix_diagrams/tree/main/lib/phoenix_diagrams/components): `lib/phoenix_diagrams/components`

### Browser experience

- [Hook exports](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/bundle_entry.js): `priv/static/phoenix_diagrams/bundle_entry.js`
- [Sidebar controls](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/sidebar_hook.js): `priv/static/phoenix_diagrams/sidebar_hook.js`
- [Pan and zoom](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/zoom_hook.js): `priv/static/phoenix_diagrams/zoom_hook.js`
- [Image download](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/download_hook.js): `priv/static/phoenix_diagrams/download_hook.js`
- [Source copying](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/copy_hook.js): `priv/static/phoenix_diagrams/copy_hook.js`
- [Link sharing](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/share_hook.js): `priv/static/phoenix_diagrams/share_hook.js`
- [Fullscreen view](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/fullscreen_hook.js): `priv/static/phoenix_diagrams/fullscreen_hook.js`
- [Source highlighting](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/highlight_hook.js): `priv/static/phoenix_diagrams/highlight_hook.js`

### Diagram rendering

- [Mermaid rendering](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/mermaid_hook.js): `priv/static/phoenix_diagrams/mermaid_hook.js`
- [PlantUML rendering](https://github.com/oshanz/phoenix_diagrams/blob/main/priv/static/phoenix_diagrams/plantuml_hook.js): `priv/static/phoenix_diagrams/plantuml_hook.js`
- **Mermaid engine**
- **PlantUML engine**

### Other components

- **Host Phoenix app**
- **User browser**

## Connections

- Host Phoenix app → Mount helper: mounts (evidence: `README.md`)
- Mount helper → Diagram LiveView: routes to (evidence: `lib/phoenix_diagrams/router.ex`)
- Mount helper → Root layout: configures layout (evidence: `lib/phoenix_diagrams/router.ex`)
- Mount helper → Asset route: forwards assets (evidence: `lib/phoenix_diagrams/router.ex`)
- User browser → Diagram LiveView: browses catalog (evidence: `README.md`)
- Hook exports → Mermaid rendering: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Hook exports → PlantUML rendering: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Hook exports → Sidebar controls: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Hook exports → Pan and zoom: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Hook exports → Image download: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Hook exports → Source copying: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Hook exports → Link sharing: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Hook exports → Fullscreen view: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Hook exports → Source highlighting: exports hook (evidence: `priv/static/phoenix_diagrams/bundle_entry.js`)
- Mermaid rendering → Mermaid engine: loads lazily (evidence: `priv/static/phoenix_diagrams/mermaid_hook.js`)
- PlantUML rendering → PlantUML engine: loads lazily (evidence: `priv/static/phoenix_diagrams/plantuml_hook.js`)
