io.github.yunshenwuchuxun/smart-drawio·Utilities

Smart Drawio

Generate, validate, repair and style editable draw.io XML diagrams.

Stars
366
Version
0.1.0
License
—
Review
Passed
Language
JavaScript
Last commit
2h ago
Forks
48
Open issues
5
Registry update
Oct 14, 2026

Connect

npm
Terminal
$claude mcp add smart-drawio \  -e SMART_DRAWIO_PROVIDER=<smart-drawio-provider> \  -e SMART_DRAWIO_BASE_URL=<smart-drawio-base-url> \  -e SMART_DRAWIO_API_KEY=<smart-drawio-api-key> \  -e SMART_DRAWIO_MODEL=<smart-drawio-model> \  -- npx -y @yunshenwuchuxun/[email protected]

Environment variables

  • SMART_DRAWIO_PROVIDER

    openai or anthropic; required only for model generation

  • SMART_DRAWIO_BASE_URL

    Model provider HTTP(S) base URL; required only for model generation

  • SMART_DRAWIO_API_KEYsecret

    Your model provider API key; required only for model generation

  • SMART_DRAWIO_MODEL

    Model identifier; required only for model generation

Security review

Review passed

Reviewed 46m ago.

metadata
scanned
packages
1 checked

No findings.

Tools

This server runs on your machine, so its tool list is not fetched before install — the README below describes what it offers.

Smart Drawio Next

中文文档

Generate editable Draw.io diagrams from natural language or reference images in seconds, optimized for research, documentation, and presentations.

Live Demo

Gallery

HomeTransformer
HomeTransformer
Swin-TransformerCLIP
Swin-TransformerCLIP

ProSST

ProSST

Overview

smart-drawio-next is a diagram generation tool built with Next.js 16, embedded Draw.io, and streaming LLM APIs. It helps you:

  • Generate structured diagrams from natural language prompts
  • Upload reference images and convert them into editable diagram content
  • Fine-tune XML / JSON in Monaco Editor
  • Sync output directly into an embedded Draw.io canvas
  • Use post-processing tools to improve layout, connectors, styles, and annotations

The project includes multi-model configuration, access-password mode, generation history, and notifications. It can be deployed as a personal tool or an internal team service.

Core Features

  • Streaming generation with support for continuing truncated outputs
  • Multimodal input with both text and image-based workflows
  • Code + canvas workflow for editing XML and previewing the result side by side
  • Post-processing toolchain for structure, text, connector, and style refinement
  • Multi-provider config management for OpenAI / Anthropic-compatible APIs
  • Local history with replay support for recent generations

Supported Diagram Types

The app supports 20+ diagram types. You can choose one explicitly or let the model decide:

  • Flowchart
  • Mind Map
  • Org Chart
  • Sequence Diagram
  • UML Class Diagram
  • ER Diagram
  • Gantt Chart
  • Timeline
  • Tree
  • Network Topology
  • Architecture Diagram
  • Data Flow Diagram
  • State Diagram
  • Swimlane Diagram
  • Concept Map
  • Fishbone Diagram
  • SWOT Analysis
  • Pyramid Diagram
  • Funnel Diagram
  • Venn Diagram
  • Matrix Diagram
  • Infographic

Built-in Themes

10 built-in color themes are available:

  • Research
  • Business
  • Warm
  • Cool
  • Dark
  • Contrast
  • Pastel
  • Forest
  • Violet
  • Neutral

Tools System

After generation, you can continue refining the diagram in the sidebar tools panel. All operations are XML-based transforms.

Drawing Tricks

Used for bulk layout and connector refinement:

  • Grid Snap
  • Orthogonal Routing
  • Curved Routing
  • Label Background
  • Consistent Spacing
  • Jump Crossings
  • Rounded Edges
  • Normalize Arrows
  • Remove Waypoints

Style Presets

Used for stackable visual effects:

  • Shadow
  • Gradient
  • Rounded
  • Glass
  • Sketch
  • Comic
  • Dashed
  • Transparent
  • Bold Stroke
  • No Stroke
  • Absolute Arc
  • Cross-Hatch
  • Dot Fill
  • Zigzag Fill
  • Semi-Opaque
  • Fade Stroke
  • Fixed Dash
  • Open Arrow

Style Packs

Used for one-click full visual styles:

  • Research Clean
  • Presentation Cards
  • Business Clean
  • Flat Minimal
  • Wireframe
  • Comic Whiteboard
  • Watercolor Sketch
  • Minimal Outline
  • Sticky Notes
  • Blueprint Tech

Text Tools

Used for batch text formatting:

  • Wrap Labels
  • Center Text
  • Text Panels
  • Bold Text
  • Compact Text
  • Text Padding

Tools System Examples

Baseline: no stylePreset: comic + cross-hatch
Baseline no styleComic and cross-hatch preset
Style pack: blueprint techStyle pack: business clean
Blueprint tech style packBusiness clean style pack

UI Structure

  1. Input Area (Chat + ImageUpload)

    • Enter prompts
    • Upload reference images
    • Stop or continue generation
  2. Code Editor

    • View and edit XML / JSON
    • Run clear, optimize, advanced optimize, and apply actions
  3. Canvas

    • Render the generated result
    • Continue editing visually in Draw.io
  4. Support Modals

    • ConfigManager
    • AccessPasswordModal
    • HistoryModal
    • OptimizationPanel
    • Other supporting panels

Tech Stack

  • Framework: Next.js 16 (App Router) + React 19
  • Canvas: Draw.io embed
  • Editor: @monaco-editor/react
  • Styling: Tailwind CSS v4
  • LLM Integration: OpenAI / Anthropic-compatible APIs with SSE streaming
  • Persistence: localStorage

Getting Started

Requirements

  • Node.js >= 18.18
  • pnpm >= 8
  • An available OpenAI / Anthropic-compatible API key

Install and Run

git clone https://github.com/yunshenwuchuxun/smart-drawio-next.git
cd smart-drawio-next
pnpm install
pnpm dev

Then open: http://localhost:3000

Common Commands

CommandDescription
pnpm devStart development server
pnpm buildBuild for production
pnpm startStart production server
pnpm lintRun ESLint
pnpm test -- runRun unit tests

Docker Deployment

Requirements

  • Docker >= 20.10
  • Docker Compose V2

Quick Start

docker compose up -d --build

Then open: http://localhost:3000

The image uses a multi-stage build and Next.js standalone output for deployment-friendly packaging.

Optional Server-Side LLM Config

If you want multiple users to share one server-side configuration, set these in docker-compose.yml:

services:
  app:
    environment:
      - ACCESS_PASSWORD=your-secure-password
      - SERVER_LLM_TYPE=openai
      - SERVER_LLM_BASE_URL=https://api.openai.com/v1
      - SERVER_LLM_API_KEY=sk-xxx
      - SERVER_LLM_MODEL=gpt-4

You can also use a .env file based on .env.example.

Proxy and Local Model Setup

If Docker needs a proxy or access to a model running on the host machine:

cp docker-compose.override.example.yml docker-compose.override.yml

Edit it for your environment, then restart:

docker compose up -d --build

Typical use cases:

  • Routing traffic through a host proxy
  • Accessing host-local Ollama or LM Studio
  • Mounting a custom CA certificate for enterprise proxies

Common Docker Commands

docker compose logs -f app
docker compose down
docker compose up -d --build
docker compose ps

LLM Configuration

Client-Side Config Mode

By default, users configure these in the UI:

  • Provider
  • Base URL
  • API Key
  • Model

All values are stored in browser localStorage only.

Server-Side Access Password Mode

If you want the API key to stay on the server:

  1. Copy the example file:
cp .env.example .env
  1. Set these variables:
  • ACCESS_PASSWORD
  • SERVER_LLM_TYPE
  • SERVER_LLM_BASE_URL
  • SERVER_LLM_API_KEY
  • SERVER_LLM_MODEL
  1. Restart the service, then users can enable the server-side config through the access password flow.

FAQ

Will my API key be uploaded to a third party?

No. Local configuration stays in the browser. Requests first go to your own server, which then calls the external model provider.

What if the output is truncated?

The UI provides a continue-generation action automatically when needed.

What if image recognition fails?

Use a vision-capable model and make sure the image format and size are valid.

Will history grow without limit?

No. The app keeps only the most recent 20 entries by default.

Credits and Contributing

  • This project is based on smart-excalidraw-next
  • If it helps you, consider:
    • Giving the repo a star
    • Sharing it with others

License

MIT

From the server's repository — third-party content, read it before running anything it suggests.

More in Utilities

Listing from the official MCP Registry · repository facts from GitHub, 49m ago.