A small HTTP service that renders Mermaid diagrams to SVG
Encode a Mermaid source as base64url (or pako: + zlib-deflated JSON) and GET it under /svg/… — the response is an inlineable image/svg+xml.
Render a Mermaid diagram. {encoded} is one of:
base64url(source) — URL-safe alphabet, padding optional.pako: + base64url(zlib_deflate(json)) where the JSON payload is {"code": "<source>", "mermaid": {"theme": "<name>"}}.| Param | Where | Notes |
|---|---|---|
theme |
query | Optional. Overrides the theme baked into the pako: payload. default / neutral / base map to the classic Mermaid look; anything else (or absent) yields the modern theme. |
token |
query or X-Api-Token header |
Required only when the operator has enabled the API token gate. |
Response: 200 with the SVG body and Cache-Control: public, max-age=31536000, immutable. Errors map to 400 (decode failure), 401 (missing/invalid token), 429 (per-IP rate limit), 503 (concurrency cap reached), or 504 (render exceeded its deadline).
ENC=$(printf 'flowchart LR; A-->B-->C' | base64 | tr '+/' '-_' | tr -d '=')
curl -s "http://localhost:3000/svg/${ENC}" > out.svg
Liveness probe. Returns the literal string ok as text/plain. Always public — exempt from the optional API token gate so uptime monitors keep working without credentials.
curl -fsS http://localhost:3000/health
This page.
A pure-Rust Mermaid renderer — parsing, layout, and SVG emission with no Node, no headless browser, no JavaScript runtime. This service is just a thin HTTP wrapper around it; every diagram you see is their work. If you find it useful, give them a star.
Star on GitHub →