Repository avatar
Developer Tools
v0.1.1
active

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.

Dragging a node on the canvas rewrites its %% @pos line in the text; editing a label in the text updates the canvas

  • Two-way sync. Edit the Mermaid architecture-beta text and the canvas follows; drag, connect, nest or rename on the canvas and the text is rewritten. Canvas positions are stored as %% @pos comments 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 validate warns 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=blue comment (hex #rgb/#rrggbb or 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-mcp lets 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.

OpsDrawdraw.ioExcalidrawMermaid
LicenseApache-2.0Apache-2.0MITMIT
Visual editorYesYesYes (hand-drawn style)No (text only)
Diagram as textYes, two-way: text and canvas edit the same fileOne-way import from MermaidOne-way import from MermaidYes
File formatMermaid .mmd with layout commentsXML (.drawio)JSON (.excalidraw)Mermaid text
Renders on GitHub/GitLab as-isYes (Mermaid)Via exported SVG/PNGVia exported SVG/PNGYes
Manual layout kept in the fileYesYesYesNo (automatic layout only)
Import from Terraform, OpenTofu, Kubernetes, etc.Yes, built inNoNoNo
CI check that a diagram matches the codeYes (opsdraw import --check, GitHub Action)NoNoNo
Git merge driver for diagram filesYesNoNoNo
MCP server for AI assistantsYes, local (stdio)Yes, officialYes, officialCommunity servers
Vendor icons (AWS, Azure, GCP)Imported by each user from the vendorBundledCommunity librariesIcon packs you register
Desktop appWindows, macOS, LinuxWindows, macOS, LinuxWeb / installable web appNo (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.

The OpsDraw editor: the Mermaid text of a three-tier AWS architecture on the left, the diagram on a canvas on the right

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.

KeysAction
Ctrl+DDuplicate the selection next to it (a group brings everything inside it)
Ctrl+C / Ctrl+XCopy / cut the selection to the clipboard, as Mermaid text you can also paste into an editor
Ctrl+VPaste at the pointer (into the group under it); pastes Mermaid copied from anywhere
Delete / BackspaceDelete the selection (the status bar offers Undo for a few seconds)
Tab / Shift+TabMove keyboard focus through the nodes in reading order, then the connections
Enter / SpaceSelect the focused node or connection; Enter on a selected one edits its label
Shift+SpaceAdd the focused node to the selection or take it out
Alt+arrow keysFocus the nearest node in that direction (the selection follows a selected node)
Arrow keysNudge the selection by 8 px
Shift+arrow keysNudge by 1 px
Ctrl+Z / Ctrl+Y (Ctrl+Shift+Z)Undo / redo a canvas edit
Ctrl+S / Ctrl+Shift+SSave / save as
Ctrl+OOpen a file
Wheel or two-finger scrollPan the canvas by default. Choose View → Wheel: Zoom to zoom instead.
Pinch or Control+wheelZoom the canvas in either wheel mode (use Control on macOS too)
Space+dragPan the canvas in either wheel mode
ClickSelect only that node or connection (on its line or its label)
Shift/Ctrl+click / Shift+dragAdd to or take out of the selection / draw a selection box
Ctrl+ASelect every node
Double-click / F2 / EnterEdit the label of a node, group or connection in place (Enter commits, Esc cancels)
EscCancel the connection being drawn or the label edit, then clear the selection
Right-click / Shift+F10 / MenuContext 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+0Fit the diagram / fit the selection / zoom to 100%
Ctrl+FFind a node, group or connection by id or label (in the code editor: its own search)
Ctrl+KCommand palette; type a node or group label to go to it
Ctrl+BShow / hide the palette
Ctrl+\Show / hide the code editor
Ctrl+.Show / hide the properties panel
Ctrl+Shift+F / EscFocus mode (only the canvas) / leave it (once nothing is selected)
Arrow keys, Home, End, EnterOn 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

PackageWhat it is
packages/coreDiagram model, Mermaid parser/serializer, IaC importers, ELK auto-layout
packages/appThe editor (React, React Flow, CodeMirror, Mermaid)
packages/cliThe opsdraw command-line tool and GitHub Action
packages/mcpThe MCP server
packages/desktopThe Tauri desktop shell around the editor

Testing

CommandWhat runs
npm testUnit tests (core, MCP tools, SVG sanitizer) and the MCP stdio integration test
npm run test:e2ePlaywright smoke and acceptance tests against the production build
npm run lintESLint
npm run typecheckTypeScript 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.

NPM
opsdraw-mcp
Install Command
npm install opsdraw-mcp
Runtime: npx