
opsdraw
io.github.eran132/opsdraw
Build, lay out and validate Mermaid architecture diagrams; import Terraform, Kubernetes and more.
Documentation
OpsDraw
Architecture as code. Draw cloud and system architecture on a canvas, or write it as text. Both views edit the same plain Mermaid file, so diagrams live in git, render on GitHub and GitLab, and can be generated from your infrastructure code or by an AI assistant over MCP.
Try it in your browser: no account, and nothing leaves your machine.

- Two-way sync. Edit the Mermaid
architecture-betatext and the canvas follows; drag, connect, nest or rename on the canvas and the text is rewritten. Canvas positions are stored as%% @poscomments and auto-layout's orthogonal edge routes as%% @route <from> <to> x,y …comments, which Mermaid ignores, so the file stays valid Mermaid everywhere. Auto-layout gives each edge its own node side, as Mermaid requires, adding a junction where a node has more than four connections; re-imports place only new nodes, next to what they connect to. - See what GitHub will show. The Mermaid preview tab runs the real Mermaid renderer; its
As GitHub renders it toggle drops icon packs, so icons GitHub and GitLab can't draw show as
the same question marks there.
opsdraw validatewarns about what stock Mermaid lays out badly: two edges on one node side, and edges whose ends it would place more than one grid step apart (it ignores@pos). - Colors and legends. Pick a color for a group or service in the inspector; it is stored as a
%% @style <id> fill=blue stroke=bluecomment (hex#rgb/#rrggbbor one of blue, green, orange, red, purple, gray, teal, yellow, which follow light/dark mode). Exports can add a legend of the icons and colors used, and edges that cross get a small line jump. - Diagrams from infrastructure code. Import Terraform, CloudFormation, Kubernetes manifests (including OpenShift, KubeVirt, Gateway API, Helm/Flux/Argo apps), cluster configs (k0sctl, Talos, k3s/RKE2), Docker Compose, Ansible inventories and Nomad jobs. On-prem virtualization is covered through Terraform: Proxmox, VergeOS, vSphere, Xen Orchestra, Nutanix, oVirt, OpenStack, libvirt/KVM, LXD/Incus, Harvester, Rancher, Hyper-V and VirtualBox. Hosts, clusters and networks become nested groups, plumbing (IAM policies, NICs, route associations…) is hidden, and references become connections.
- Exports that match the canvas. SVG and PNG exports are drawn from your layout (not
re-laid-out by Mermaid), use plain text that works in Inkscape, Confluence and other viewers,
follow light/dark mode, and embed the diagram source, so an exported image can be reopened and
edited. Export → Isometric SVG/PNG (or
opsdraw export --iso) draws the same layout in 2.5D, with groups as plates and services as blocks;%% @z <id> <n>lifts a node or group by whole tiers. - Problems where they are. The app runs the same checks as
opsdraw validate: parse errors, unknown icons, two edges on one node side, and what GitHub's Mermaid can't draw. They are listed under the editor (click a row to go to its line, or apply a fix such as "Use lucide:server"), marked in the editor's gutter, and badged on the nodes. While the text doesn't parse, the canvas keeps the last valid version, dimmed. Warnings never block saving or exporting. - MCP server.
opsdraw-mcplets Claude and other MCP clients create and edit diagrams and import infrastructure code. The app picks up those edits live in the file you have open. - Icons without legal trouble. A vendor-neutral icon set (Lucide) is built in. Official AWS, Azure and Google Cloud packs are imported by each user from the vendor's download page; see TRADEMARKS.md.
- Multilingual. English, Hebrew, Arabic, Spanish, French, German, Japanese and Chinese, with full right-to-left support.
- Cross-platform. Runs in any modern browser, and as a Windows/macOS/Linux desktop app (Tauri) with native open/save dialogs; see packages/desktop/README.md.
Keep diagrams in sync with your infrastructure
The opsdraw CLI imports infrastructure code into a diagram and keeps your hand-made layout on
every re-import. In CI, --check fails when the committed diagram no longer matches the code:
# .github/workflows/diagrams.yml
on: pull_request
jobs:
diagram:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: eran132/opsdraw@main
with:
source: infra
diagram: docs/architecture.mmd
recursive: true
Terraform and OpenTofu are read from source (.tf, .tofu, local modules, count/for_each)
or, for exact results, from terraform show -json / tofu show -json plan or state output. See
packages/cli/README.md for all commands.
Example
architecture-beta
group cloud(cloud)[Cloud]
service lb(internet)[Load balancer] in cloud
service api(server)[API] in cloud
service db(database)[Database] in cloud
lb:R --> L:api
api:R --> L:db
How OpsDraw compares
OpsDraw is narrower than general-purpose diagram tools: it is built for architecture diagrams that live in git next to the infrastructure they describe.
| OpsDraw | draw.io | Excalidraw | Mermaid | |
|---|---|---|---|---|
| License | Apache-2.0 | Apache-2.0 | MIT | MIT |
| Visual editor | Yes | Yes | Yes (hand-drawn style) | No (text only) |
| Diagram as text | Yes, two-way: text and canvas edit the same file | One-way import from Mermaid | One-way import from Mermaid | Yes |
| File format | Mermaid .mmd with layout comments | XML (.drawio) | JSON (.excalidraw) | Mermaid text |
| Renders on GitHub/GitLab as-is | Yes (Mermaid) | Via exported SVG/PNG | Via exported SVG/PNG | Yes |
| Manual layout kept in the file | Yes | Yes | Yes | No (automatic layout only) |
| Import from Terraform, OpenTofu, Kubernetes, etc. | Yes, built in | No | No | No |
| CI check that a diagram matches the code | Yes (opsdraw import --check, GitHub Action) | No | No | No |
| Git merge driver for diagram files | Yes | No | No | No |
| MCP server for AI assistants | Yes, local (stdio) | Yes, official | Yes, official | Community servers |
| Vendor icons (AWS, Azure, GCP) | Imported by each user from the vendor | Bundled | Community libraries | Icon packs you register |
| Desktop app | Windows, macOS, Linux | Windows, macOS, Linux | Web / installable web app | No (CLI and renderers) |
Hosted tools such as Eraser, Miro and Lucidchart also offer AI generation and MCP integrations; they run in the vendor's cloud, so diagrams and prompts are processed on their servers.
Comparison as of October 2026. Products change quickly: if something here is out of date, please open an issue. draw.io, Excalidraw, Mermaid, Eraser, Miro and Lucidchart are trademarks of their respective owners; OpsDraw is not affiliated with them.
Getting started
The hosted build at https://eran132.github.io/opsdraw/ is the same app; the steps below run it locally. Sample diagrams to open with File › Open are in examples/.
To start a new diagram, use File › New from template… (also in the command palette, and on the
card an empty canvas shows). Six laid-out starters ship with the app: a three-tier web app, a
Kubernetes platform, an event-driven serverless app, a data platform, a homelab, and a hybrid
on-premises and cloud setup. They are plain .mmd files in
packages/app/src/templates/, so you can also copy one straight into a
repository.

Requires Node.js 20.19 or newer.
npm install
npm run dev
Then open http://localhost:5173.
Keyboard shortcuts
On macOS, use Cmd instead of Ctrl. Canvas shortcuts apply while the canvas has focus; in the code editor and in text fields the keys keep their usual meaning.
| Keys | Action |
|---|---|
| Ctrl+D | Duplicate the selection next to it (a group brings everything inside it) |
| Ctrl+C / Ctrl+X | Copy / cut the selection to the clipboard, as Mermaid text you can also paste into an editor |
| Ctrl+V | Paste at the pointer (into the group under it); pastes Mermaid copied from anywhere |
| Delete / Backspace | Delete the selection (the status bar offers Undo for a few seconds) |
| Tab / Shift+Tab | Move keyboard focus through the nodes in reading order, then the connections |
| Enter / Space | Select the focused node or connection; Enter on a selected one edits its label |
| Shift+Space | Add the focused node to the selection or take it out |
| Alt+arrow keys | Focus the nearest node in that direction (the selection follows a selected node) |
| Arrow keys | Nudge the selection by 8 px |
| Shift+arrow keys | Nudge by 1 px |
| Ctrl+Z / Ctrl+Y (Ctrl+Shift+Z) | Undo / redo a canvas edit |
| Ctrl+S / Ctrl+Shift+S | Save / save as |
| Ctrl+O | Open a file |
| Wheel or two-finger scroll | Pan the canvas by default. Choose View → Wheel: Zoom to zoom instead. |
| Pinch or Control+wheel | Zoom the canvas in either wheel mode (use Control on macOS too) |
| Space+drag | Pan the canvas in either wheel mode |
| Click | Select only that node or connection (on its line or its label) |
| Shift/Ctrl+click / Shift+drag | Add to or take out of the selection / draw a selection box |
| Ctrl+A | Select every node |
| Double-click / F2 / Enter | Edit the label of a node, group or connection in place (Enter commits, Esc cancels) |
| Esc | Cancel the connection being drawn or the label edit, then clear the selection |
| Right-click / Shift+F10 / Menu | Context menu of a node, selection, connection or the empty canvas |
| Connect to… | In the context menu, the properties panel or Ctrl+K: connect the selected node to another |
| Shift+1 / Shift+2 / Shift+0 | Fit the diagram / fit the selection / zoom to 100% |
| Ctrl+F | Find a node, group or connection by id or label (in the code editor: its own search) |
| Ctrl+K | Command palette; type a node or group label to go to it |
| Ctrl+B | Show / hide the palette |
| Ctrl+\ | Show / hide the code editor |
| Ctrl+. | Show / hide the properties panel |
| Ctrl+Shift+F / Esc | Focus mode (only the canvas) / leave it (once nothing is selected) |
| Arrow keys, Home, End, Enter | On a focused panel divider: resize, smallest / largest size, collapse or restore |
Drag the dividers between the panels to resize them, or double-click one to collapse its panel; View in the app bar shows or hides each panel, puts the code editor beside or above the canvas, and resets the layout. Windows from 1100 to 1499 px wide start with the code editor above the canvas; once you change the layout it is remembered. In windows narrower than 1100 px the properties panel opens while something is selected.
Selection is linked between the code and the canvas: selecting a node marks its service or group line in the code editor with a bar and dims its %% @pos, @style and @route lines, and putting the cursor on a line selects that node or connection on the canvas, panning only when it is out of view. Reveal in code in the context menu jumps to the line.
Click a palette tile with nothing selected to add it in the middle of the view, or drag it to a spot; with a node selected, a click changes its icon. Delete, paste, auto layout and import show a message with Undo in the status bar. Help links to these shortcuts, the documentation and the issue tracker.
Moving nodes (dragging, aligning, nudging) re-picks the attachment sides of their edges, so two nodes lined up get a straight edge.
Command line
No install needed; npm runs it on demand:
npx opsdraw import infra --recursive -o docs/architecture.mmd
Export an SVG from the stored layout, flat or isometric (--angle 0|90|180|270 picks the corner
it is seen from):
npx opsdraw export docs/architecture.mmd -o docs/architecture.svg
npx opsdraw export docs/architecture.mmd -o docs/architecture-iso.svg --iso --angle 90
Or install it globally with npm install -g opsdraw. See packages/cli/README.md.
MCP server
Give Claude Code (or any MCP client) the diagram tools:
claude mcp add opsdraw -- npx -y opsdraw-mcp
Or install it as a Claude Code plugin, which adds a skill that teaches Claude how to build and maintain the diagrams:
claude plugin marketplace add eran132/opsdraw
claude plugin install opsdraw@opsdraw
See packages/mcp/README.md for the full tool list, the skill and configs for Claude Desktop, Cursor, VS Code and Windsurf.
Project layout
| Package | What it is |
|---|---|
packages/core | Diagram model, Mermaid parser/serializer, IaC importers, ELK auto-layout |
packages/app | The editor (React, React Flow, CodeMirror, Mermaid) |
packages/cli | The opsdraw command-line tool and GitHub Action |
packages/mcp | The MCP server |
packages/desktop | The Tauri desktop shell around the editor |
Testing
| Command | What runs |
|---|---|
npm test | Unit tests (core, MCP tools, SVG sanitizer) and the MCP stdio integration test |
npm run test:e2e | Playwright smoke and acceptance tests against the production build |
npm run lint | ESLint |
npm run typecheck | TypeScript across all packages |
CI runs all of them on Windows, macOS and Linux.
License
Apache License 2.0. Third-party notices are in NOTICE. Vendor names are trademarks of their owners; OpsDraw is not affiliated with any vendor.
opsdraw-mcpnpm install opsdraw-mcp