A lightning-fast, 100% client-side, and local-first PlantUML-like diagram generator for the web.
PlantUML is a fantastic, industry-standard tool loved by developers worldwide for defining diagrams as code.
SnapUML brings that same intuitive, PlantUML-like writing experience directly to modern web browsers. It is a lightweight, dependency-free compiler designed to parse and render diagrams entirely client-side, making it incredibly easy to integrate interactive diagrams into web applications, personal blogs, or internal wikis.
- ✍️ Intuitive PlantUML-like Syntax: Write your sequence and component diagrams using the clean, expressive syntax you already know and love.
- 🔒 Private & Secure by Design: Since the entire parsing and rendering process happens locally in the user's browser, your architecture data and code never leave your machine.
- ⚡ Real-time, Local Rendering: Experience instant preview generation as you type, with zero network latency or server roundtrips.
- 📦 Zero External Dependencies: No Java runtime, no Graphviz installation, and no backend servers required. It's a pure, lightweight TypeScript/JavaScript solution.
- 📶 Works Offline: Because it runs 100% client-side, you can generate and view diagrams anytime, anywhere, without an internet connection.
- PlantUML-like Syntax: Use familiar PlantUML-inspired declarations for rapid diagramming.
- Supported Diagrams:
- Sequence Diagrams (with actors, participants, boundaries, and control flows)
- Component Diagrams (with components, interfaces, database, package structures)
- Automatic Inline Rendering: Easily embed and auto-render diagram code blocks on any webpage.
- Ultra-Portable: Easily packageable as a lightweight ES Module or IIFE script.
Simply include the built script and initialize it. SnapUML will scan and auto-convert all <pre class="snapuml"> blocks into interactive SVG diagrams instantly!
<!-- Load SnapUML -->
<script src="dist/snapuml.min.js"></script>
<!-- Initialize auto-rendering -->
<script>
snapuml.initialize();
</script>
<!-- Write your diagrams in plain text -->
<pre class="snapuml">
participant User
participant API
database DB
User -> API: GET /users
API -> DB: Query User
DB --> API: User Data
API --> User: 200 OK (JSON)
</pre>import snapuml from 'snapuml';
const code = `
[Component A] -> [Component B] : API Request
`;
// Render to SVG string
const svgString = snapuml.render(code);- Node.js (v18.0.0 or later recommended)
- npm
npm installGenerate browser bundles, minified versions, and ES Modules in the dist/ directory:
npm run buildThis compiles:
dist/snapuml.js- Browser IIFE bundledist/snapuml.min.js- Minified Browser IIFE bundledist/snapuml.esm.mjs- ES Module bundledist/snapuml.esm.min.mjs- Minified ES Module bundle
npm run type-checkEnsure everything is solid before deploying:
npm run testThis project is licensed under the MIT License - see the LICENSE file for details.