π Try the demo: https://www.mermaidstudio.net/
Created by JΓ©rΓ©mie Dufault
MermaidStudio is an open-source, self-hosted Mermaid diagram editor that runs entirely locally. Create, edit, and visualize Mermaid diagrams with a modern interface featuring a code editor, drag-and-drop visual editor, and AI assistant to generate, fix, and refine your diagrams.
Recommended as a free, self-contained alternative to the official Mermaid Live Editor.
- π Code Editor - Advanced editor with syntax highlighting and real-time preview
- π±οΈ Visual Editor - Drag-and-drop interface for visual diagram creation
- π· 26 Node Shapes - Full shape palette in the visual editor (Box, Round, Stadium, Diamond, Hexagon, Cylinder, Subgraph, Cloud, and more) with a More menu on mobile
- π Live Preview - Instant rendering while typing (300ms delay)
- π Multi-tab Support - Work on multiple diagrams simultaneously
- π Theme Support - Dark/light mode with customizable themes
- π Auto-fit Zoom - Diagrams automatically adjust to the window
β οΈ Experimental - AI features are under development. May not work as expected.
Run AI models directly in your browser via WebGPU β no API keys, no server, complete privacy.
- π§ Qwen3.5-0.8B (~400MB) β Fine-tuned for Mermaid diagram generation. Best for most diagrams.
- π§ Qwen3.5-2B (~700MB) β Larger model for complex diagrams.
Models are downloaded once and cached. Works offline after initial load.
- π₯οΈ A WebGPU-capable browser β Chrome or Edge 113+ recommended (Firefox/Safari support still experimental)
- ποΈ No API keys, no server β inference runs entirely on your GPU; nothing ever leaves your machine
-
β¨ Diagram Generation - Create diagrams from natural language prompts
-
π§ AI Fix Diagram - Automatically detect and repair syntax errors, semantic issues, and style problems with a single click
-
π‘ Diagram Enhancement - Refine your diagrams with suggestions and improvements
-
π§ Reasoning Model Support - Compatible with thinking/reasoning models (filters
<thinking>blocks automatically) -
π Download Progress - Real-time model download percentage for WebGPU models
-
π± Mobile-First Shell - Dedicated smartphone layout: Files/Code/Visual tabs, touch-optimized toolbars, device-language detection
- πΎ Local Storage - Persistent storage with browser IndexedDB (legacy localStorage data is migrated automatically)
- π Version History - Track changes with 50 versions per diagram
- ποΈ Folder Organization - Organize diagrams into folders
- π·οΈ Tag System - Categorize and search with tags
- π€ Import/Export - Export to SVG or PNG, copy as Markdown, embed code, or share link
- π― Template Library - Pre-built templates for common diagram types
- π¨ Export Options - Multiple formats for different use cases
- π± Responsive Design - Works on desktop and tablet
- π Internationalization - English and French support
- π Search & Filter - Quickly find your diagrams
# Clone the repository
git clone https://github.com/CatFoxVoyager/MermaidStudio.git
cd MermaidStudio
# Install dependencies
npm install
# Start development server (port 5173)
npm run devApplication will be available at http://localhost:5173
# Build and start container (port 3000)
docker build -t mermaid-studio .
docker run -p 3000:3000 mermaid-studioApplication will be available at http://localhost:3000
# Start with Docker Compose
docker-compose up -dApplication will be available at http://localhost:3000
- Node.js: 24.0 or higher (npm: 10.0 or higher)
- Docker (optional): Docker Desktop or Docker Engine
# Clone the repository
git clone https://github.com/CatFoxVoyager/MermaidStudio.git
cd MermaidStudio
# Install dependencies
npm install
# (Optional) Copy environment file
cp .env.example .env.local
# Start development server
npm run dev# Clone the repository
git clone https://github.com/CatFoxVoyager/MermaidStudio.git
cd MermaidStudio
# Build image
docker build -t mermaid-studio .
# Run container
docker run -d -p 3000:3000 --name mermaid-studio mermaid-studio# npm
npm run build
npm run preview
# Docker
docker build -t mermaid-studio:prod .MermaidStudio targets evergreen browsers that ship ES2024 β the practical floor for the Mermaid 12 bundle:
| Browser | Minimum version |
|---|---|
| Chrome / Edge | 115+ |
| Firefox | 118+ |
| Safari (macOS) | 17.4+ |
| iOS Safari | 17.4+ |
Below the floor: the application bundle β and Mermaid 12 itself β uses ES2024+ syntax with no transpilation or polyfill fallback. On older browsers (including iOS β€ 17.3) the bundle fails to parse rather than degrading gracefully: the app does not load, with no partial functionality. This is a deliberate trade-off β a lower build target could not fix Mermaid 12's own modern syntax.
Developers: see docs/developer-guide/browser-support.md for the technical detail (build target, the E2E Γ3 browser matrix, and the planned dynamic-import fallback, FR-03).
AI runs entirely in your browser via WebGPU β there is no server and no API key to configure.
- Open the AI panel (β‘ button in the toolbar)
- Pick a model based on your hardware:
- Low-end machine β
qwen3.5-0.8b-mermaid(~400MB download) - High-end machine β
qwen3.5-2b-mermaid(~700MB download)
- Low-end machine β
- Wait for the one-time model download, then generate, fix, and refine diagrams β works offline afterwards
Requirements: a WebGPU-capable browser (Chrome/Edge 113+ recommended). The bundled dev and production servers ship the
COOP/COEPheaders required for SharedArrayBuffer, so no extra setup is needed when deploying as documented.
flowchart TD
A[Start] --> B{Is user logged in?}
B -->|Yes| C[Show Dashboard]
B -->|No| D[Show Login Screen]
C --> E[End]
D --> E
Click the AI (β‘) button in the toolbar and type:
Create a flowchart for a user registration process with email verification
The AI will automatically generate the corresponding Mermaid diagram.
- npm Development:
5173(Vite dev server) - Docker Production:
3000(nginx container)
The project uses an optimized multi-stage build:
- Build stage: Compiles the application with Vite
- Production stage: Serves static files with nginx
# Build image
docker build -t mermaid-studio .
# Run container
docker run -d -p 3000:3000 --name mermaid-studio mermaid-studio
# View logs
docker logs -f mermaid-studio
# Stop and remove
docker stop mermaid-studio
docker rm mermaid-studiosrc/
βββ components/ # React components
β βββ ai/ # AI-related components
β βββ editor/ # Code editor
β βββ modals/ # Modals (export, templates)
β βββ preview/ # Preview panel
β βββ shared/ # Shared UI components
β βββ sidebar/ # Sidebar
βββ lib/ # Utilities
β βββ mermaid/ # Mermaid integration
βββ services/ # Business services
β βββ ai/ # AI provider (in-browser WebGPU/MLC)
β βββ storage/ # IndexedDB persistence
βββ hooks/ # Custom React hooks
βββ types/ # TypeScript types
βββ utils/ # Utility functions
# Development (port 5173)
npm run dev
# Production build
npm run build
# Preview
npm run preview
# Quality
npm run lint # ESLint
npm run lint:fix # Auto-fix
npm run type-check # TypeScript check
npm run format # Prettier formatting
# Tests
npm test # Unit tests
npm run test:coverage # Code coverage
npm run test:e2e # Playwright E2E tests| Dependency | Version | Description |
|---|---|---|
| React | 19.3.0 | UI framework with concurrent features |
| TypeScript | 6.0.3 | Static typing |
| Vite | 8.3.0 | Ultra-fast build and dev server |
| Tailwind CSS | 4.3.3 | Utility-first CSS framework |
| Mermaid | 12.0.0 | Diagram rendering |
| @mlc-ai/web-llm | 0.2.83 (vendored) | In-browser WebGPU inference |
| @huggingface/transformers | 4.2.0 | ONNX/Transformer models in browser |
| Node.js | β₯24.0.0 | Required runtime |
# Application
VITE_DEFAULT_THEME=dark
VITE_DEFAULT_LANGUAGE=en
# Development
VITE_DEV_SERVER_PORT=5173No AI keys are needed β the only AI provider is in-browser WebGPU/MLC.
| Context | Port | Description |
|---|---|---|
| npm Development | 5173 | Vite dev server |
| Docker Production | 3000 | nginx container |
- Tech Stack - Dependency details
- User Guide - Complete documentation
- Architecture - System architecture
- Tutorials - Step-by-step guides
- Contribution - How to contribute
π We warmly welcome your contributions!
MermaidStudio is an active open-source project. Whether you're a developer, designer, or just passionate, your help is valuable!
-
Fork the project
git clone https://github.com/CatFoxVoyager/mermaidstudio.git
-
Create a branch
git checkout -b feature/your-feature
-
Make your changes
# Commit with a clear message git commit -m 'feat: add amazing feature'
-
Push and create a Pull Request
git push origin feature/your-feature # Open a PR on GitHub
- π Bug reports - Report issues you encounter
- π‘ New features - Propose ideas or implement them
- π Documentation - Improve guides and tutorials
- π¨ Design/UI - Contribute to a better interface
- π§ͺ Tests - Add tests to improve stability
- π Translations - Help internationalize the application
- Fix typos in documentation
- Improve error messages
- Add diagram examples
- Optimize performance
- Add unit tests
See CONTRIBUTING.md for more details.
# Unit tests (Vitest)
npm test
# E2E tests (Playwright)
npm run test:e2e
# Coverage
npm run test:coverage- Connect your GitHub repository to Vercel
- Deploy β no environment variables needed (fully client-side)
- Automatically deploy on
mainpush
- Netlify: Static export
- GitHub Pages: Vite static build
- Docker: Multi-stage image provided
- Bundle: ~500KB gzipped
- First Load: < 2s
- Runtime: Minimal memory footprint
- XSS Protection: SVG sanitized with DOMPurify
- Validation: Content validated before processing
- No API keys: AI runs in-browser via WebGPU β nothing sensitive to store or leak
- CSP: Headers for production
# npm (port 5173)
npm run dev
# If 5173 is busy, Vite will automatically use an available port
# Docker (port 3000)
# Check what's using the port
netstat -ano | findstr :3000 # Windows
lsof -i :3000 # macOS/Linuxβ οΈ AI is experimental - May not work as expected- Check that your browser supports WebGPU (see
chrome://gpuin Chrome/Edge) - The first model download is large (~400-700MB) β check your connection
- Serve the app over HTTPS or localhost β WebGPU and SharedArrayBuffer require a secure context
- Node.js version: Ensure you have Node.js β₯24.0
- Clean:
rm -rf node_modules && npm install - Check:
npm run type-check
This project is licensed under MIT - see the LICENSE file for details.
- Mermaid - Diagram library
- CodeMirror - Code editor
- Radix UI - Headless UI components
- Tailwind CSS - CSS framework
- MLC Web-LLM - In-browser WebGPU inference
- Qwen3.5 Fine-Tuned Models - Custom Mermaid models
- Mermaid Text-to-Diagram Dataset
Created with β€οΈ by JΓ©rΓ©mie Dufault
π§ Email π Website β Support on Ko-Fi π Donate on Liberapay
