Excalidraw
Excalidraw produces clean hand-drawn-style diagrams. Emit a .excalidraw JSON file the user can open in the Excalidraw editor (or excalidraw CLI), and optionally export to SVG.
When to use
- "make an excalidraw / sketch / whiteboard of …"
- Concept maps, org charts, rough architecture sketches where a polished SVG is overkill.
- The user explicitly asks for hand-drawn style.
How to produce
- Compose the scene as
.excalidrawJSON: elements (rectangle,ellipse,diamond,arrow,line,text) withx/y/width/height,strokeColor,backgroundColor,fontSize, and bound labels. - Connect shapes with arrows that reference
startBinding/endBindingto element IDs so they stay attached. - Save to
<name>.excalidrawand state the path. - If a static export is wanted, convert to SVG/PNG (excalidraw CLI or the npm
@excalidraw/utilspackage viabunx).
Minimal element template
{
"type": "excalidraw",
"version": 2,
"source": "cybara",
"elements": [
{
"type": "rectangle", "x": 100, "y": 100, "width": 160, "height": 60,
"strokeColor": "#1e1e1e", "backgroundColor": "transparent",
"id": "node1", "seed": 1, "roughness": 1, "strokeWidth": 2
},
{
"type": "text", "x": 130, "y": 122, "width": 100, "height": 20,
"text": "Service A", "fontSize": 16, "id": "t1", "seed": 2
}
],
"appState": { "viewBackgroundColor": "#ffffff" }
}
Keep element IDs unique; use seed values to keep rendering deterministic. Prefer grouping with a consistent palette.