Skip to content

Diagram Generator

/diagrams generates visual architecture diagrams from topology data without Visio or draw.io. The pipeline:

topology_nodes + edges + zones
▼ scope filter (env / type / id / only_managed)
▼ layout engine (hierarchical | force | concentric | zone)
▼ styling (env-color per node, encryption-color per edge)
▼ optional: Ollama AI analysis → summary + risks
▼ React Flow canvas (drag-to-edit, save with version history)
▼ export PNG | SVG | PDF | Mermaid

Layout Algorithms

AlgorithmWhen to Use
hierarchicalN-tier architecture, request flow, firewall → server chains. Coffman-Graham BFS, deterministic sort per layer
forceMesh networks, microservices, organic topologies. Fruchterman-Reingold, 300 iterations, critical edges drawn 2× stronger
concentricBlast radius visualization, dependency analysis. Focus node in center, rings 1/6/12/18/24
zoneCompliance documentation, network segmentation. Swimlanes per environment in fixed order (internet → dmz → prod → …)

Diagram Types

TypeFiltering
architectureall nodes (default)
network_flowall nodes, edges shown with direction
dependency3-hop BFS from focus_node_id
compliance_zoneswimlanes per environment, with group rectangles
blast_radiusconcentric layout from focus node
data_flowall nodes with traffic_profile=continuous = animated

Templates

5 built-in patterns ready to clone:

  • 3-Tier Web Application — Internet → Firewall → LB → Web Servers → DB
  • Microservices — API Gateway with 4 backend services + DB
  • Hub & Spoke Network — central hub with 4 branch locations via IPsec
  • Zero Trust Architecture — Identity Provider + IAP + apps + SIEM
  • DR/Backup Setup — Production + DR replica + offsite S3 + monitoring

POST /api/v1/diagrams/from-template/:id clones a template as new diagram.

AI Analysis (Ollama)

With include_ai: true, the generator makes one Ollama call with the full node + edge list plus statistics (unencrypted edges, critical edges, compliance gaps). The LLM returns:

{
"summary": "2-3 sentence summary of the architecture",
"risks": [
{ "severity": "high", "description": "", "remediation": "" }
]
}

Timeout 60 sec, model llama3.1:8b, runs locally in same Docker stack (no external AI provider). On LLM response parse error, the system falls back to raw text as summary.

Export

FormatHow
PNGclient-side via html-to-image, 2× pixelRatio for retina quality
SVGclient-side via html-to-image’s toSvg
PDFPNG embed in jsPDF on landscape 1920×1080
Mermaidserver-side via /api/v1/topology/export/mermaid
Sharingpublic read-only link via POST /api/v1/diagrams/:id/share — 32-char URL-safe token, no expiry, tenant_id stripped from response

API

MethodPath
GET /api/v1/diagramslist diagrams + node/edge counts
POST /api/v1/diagrams/generatelayout + style + optional auto_save
GET /api/v1/diagrams/templatesbuilt-in + tenant templates
POST /api/v1/diagrams/from-template/:idclone template
GET /api/v1/diagrams/:id · PUT · DELETECRUD with version history on PUT
POST /api/v1/diagrams/:id/share · unsharepublic link toggle
GET /api/v1/diagrams/share/:tokenpublic (no-auth) read-only

Version History

Each PUT /diagrams/:id snapshot the previous version to diagram_versions with change_summary. No UI to see diff’s (on roadmap), but data is there for forensic recovery.

Limitations

  • No real-time collaboration — multiple editors overwrite each other’s changes. Work per person, use snapshots as synchronization points.
  • No draw.io XML export — Mermaid is available; draw.io can import Mermaid.
  • Per-node AI annotations are not yet available — only tenant-level summary + risks.
  • Crossing minimization — hierarchical layout does no Sugiyama edge-crossing optimization. For diagrams with 50+ nodes, we recommend the zone or force layout.