AI-powered diagram editor where every diagram is code β describe it, render it, version it, self-host it.
Why Β· Features Β· Quick Start Β· Architecture Β· API Β· Roadmap
Every AI diagramming tool hits the same wall: the output is a picture. You can't diff it, you can't version it, you can't regenerate it from the source of truth. Graphini is different because every diagram is a Mermaid / Structurizr text artifact β so it lives in git, diffs in PRs, and renders deterministically every time.
- Diagrams-as-code, not canvas blobs. Output is Mermaid (flowchart, sequence, ER, state, class, gitgraphβ¦) or Structurizr DSL β plain text you can check in.
- Real multi-provider AI. Built on the Vercel AI SDK with OpenAI, Anthropic, OpenRouter, and Gemini. Swap providers without code changes.
- Cloud architecture, done right. AWS icon pack is built into the bundle via a pre-build script, so your architecture diagrams use real service icons β not generic boxes.
- Memory that sticks. User memories let Graphini learn your naming conventions, preferred diagram style, and domain vocabulary across sessions.
- Self-hostable. Docker, Node adapter, static adapter, or Vercel β pick your deployment. No lock-in.
Unlike canvas-based AI tools like Excalidraw-plus-plugins or closed-format drag-drop editors, Graphini produces text-first diagrams you own, version, and re-render forever β with a workspace, file persistence, and a proper API on top.
Click to expand
There are plenty of ways to make a diagram with AI. None of them do the job Graphini does, because each was built for a different workflow:
| Tool | What it answers | Where Graphini differs |
|---|---|---|
| Mermaid Live Editor | "I already wrote Mermaid, render it" | No AI β you write the DSL by hand. Graphini generates and iterates it for you. |
| ChatGPT / Claude "make me a diagram" | "One-shot, throwaway diagram" | No persistence, no memories, no workspace, no files, no Structurizr, no AWS icons, no API. |
| Excalidraw + AI plugins | "Sketch it out visually" | Canvas-blob output β not text, not versionable, not regeneratable from source. |
| draw.io / Lucidchart | "Drag-and-drop corporate diagrams" | Manual, closed-format, no AI-native editing loop. |
| Eraser.io | "Paid hosted AI diagrams" | Closed-source, closed-format, single-provider. Graphini is open-source, self-hostable, multi-provider. |
| Structurizr Lite | "C4 architecture diagrams from DSL" | No AI authoring, no chat loop. Graphini speaks Structurizr and Mermaid in the same workspace. |
| Graphini (this project) | "Describe what I want β get versionable diagram code β iterate it with AI β ship it in git." | Diagrams-as-code Β· multi-provider AI Β· memories Β· workspace Β· files Β· AWS icons Β· Structurizr Β· self-host |
You could glue GPT to Mermaid Live Editor in an afternoon. Graphini does seven things on top that a wrapper does not:
- Multi-DSL, not just Mermaid. The
structurizrfeature adds full C4 model support β so architects get real C1/C2/C3 diagrams, not just flowcharts with rounded corners. - AWS icon pack baked into the build.
scripts/build-aws-icon-pack.mjsruns onpredev/prebuildand ships real AWS service icons into the bundle. Your "architecture" diagrams look like architecture. - Persistent files, not ephemeral chats. Projects have real files (see
add-files-persistence.sql), so a single diagram can grow across sessions instead of getting lost when a chat resets. - User memories. The
user_memoriestable lets the AI remember your naming conventions, preferred layout direction, and domain vocabulary β so you don't re-explain "we always usesvc_*for services" every session. - Workspace + admin panel. Multi-user workspace, admin settings, app settings β it's a product, not a demo. See
src/routes/workspaceandsrc/routes/admin. - A real, documented API.
api/openapi.yamlspec. Build your own integrations or drive Graphini from CI. - Provider-agnostic via Vercel AI SDK. Swap OpenAI β Anthropic β OpenRouter β Gemini in settings. No hard-coded provider, no vendor lock-in.
Graphini is not a free-form whiteboard. If you want pixel-perfect hand-drawn canvases with stickies and arrows-that-bend-where-you-want, use Excalidraw. If you want a corporate visio-style drag-drop environment with a thousand stencils, use Lucidchart or draw.io. If you just need to render Mermaid you already wrote, use Mermaid Live Editor.
Use Graphini when you want your diagrams to live in git β versionable, diffable, AI-editable, and rebuildable β with real cloud icons, real C4 support, and a real API around them.
- Plain-English prompts turn into Mermaid or Structurizr DSL
- AI-powered editing β modify, expand, restyle, or refactor with chat commands
- Real-time preview β diagram updates as the code streams
- Mermaid β flowcharts, sequence, class, state, ER, gitgraph, C4, mindmap, timeline, and more
- Structurizr DSL β full C4 model support for software architecture
- Text-first output β every diagram is a plain-text artifact you can version-control
- AWS icon pack built into the bundle via
scripts/build-aws-icon-pack.mjs - Real AWS service icons in generated diagrams β not placeholder boxes
- Per-user memory table so the AI remembers your conventions across sessions
- Naming patterns, preferred direction, domain vocabulary β learned once, reused forever
- Persistent files β multi-file projects, not single-diagram toys
- Workspace with dashboard, edit, and view modes
- Admin panel β user management, app settings, provider config
- Built on the Vercel AI SDK (
ai,@ai-sdk/anthropic,@ai-sdk/openai) - Supports OpenAI Β· Anthropic Β· OpenRouter Β· Gemini
- Swap providers in settings β no code change, no redeploy
- Supabase Authentication
- Drizzle ORM with PostgreSQL β typed migrations, checked-in schemas
- Performance indexes SQL shipped in
database/
- Documented API via
api/openapi.yaml - Docker + docker-compose self-hosting
- Node adapter, static adapter, or Vercel adapter β pick your deployment
- Nginx reverse-proxy config included
- Vitest for unit tests
- Playwright for E2E
- Coverage via
@vitest/coverage-v8
| Layer | Technology |
|---|---|
| Framework | SvelteKit 2 Β· Vite Β· TypeScript 5 |
| Styling | Tailwind CSS v4 Β· bits-ui Β· @tailwindcss/typography |
| Icons | Lucide Β· Iconify Β· Material Symbols Β· MDI Β· AWS icon pack |
| Diagram Engines | Mermaid.js Β· Structurizr DSL |
| AI Gateway | Vercel AI SDK β OpenAI Β· Anthropic Β· OpenRouter Β· Gemini |
| Auth | Supabase Authentication |
| Database | PostgreSQL via Drizzle ORM |
| Testing | Vitest Β· Playwright |
| Linting | ESLint 9 Β· Prettier Β· eslint-plugin-svelte Β· eslint-plugin-tailwindcss |
| Deployment | Vercel Β· Node adapter Β· Static adapter Β· Docker Β· Netlify Β· Nginx |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SvelteKit (Vite + TS + Tailwind v4) β
β β
β Routes: dashboard Β· workspace Β· edit Β· view Β· canvas β
β admin Β· api β
β β
β Features: β
β ββββββββββ ββββββββββ βββββββββββββββ βββββββββββ β
β β chat β βdiagram β β structurizr β β editor β β
β ββββββββββ ββββββββββ βββββββββββββββ βββββββββββ β
β β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SvelteKit API routes (server hooks, OpenAPI spec) β
β β
β βββ Vercel AI SDK βββΆ OpenAI Β· Anthropic Β· OR Β· Gemini β
β βββ Drizzle ORM βββΆ PostgreSQL β
β β β’ users Β· files Β· memories β
β β β’ app_settings Β· admin_settingsβ
β βββ Supabase Auth βββ session + RLS β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Key design decisions
- π Text artifacts, not canvas blobs. Diagrams are Mermaid/Structurizr strings end-to-end β they round-trip through git cleanly.
- π§± Feature-scoped modules.
src/lib/features/{chat,diagram,editor,structurizr,history,icons}β each feature owns its stores, components, and types. - π¨ Design tokens in code.
src/lib/design-tokens.tsandsrc/lib/themes/β swappable at runtime. - π Vercel AI SDK as the single LLM surface. Provider swap = settings change, not refactor.
- π§ͺ Serious test posture. Vitest for units, Playwright for E2E, coverage gates in CI.
- π³ Multi-adapter deployment. Node for self-hosters, static for CDN, Vercel for zero-config, Docker for everything else.
- Node.js 20+
- pnpm 9+
- PostgreSQL database (local or hosted)
- (optional) Supabase project for auth
git clone https://github.com/omkarbhad/graphini.git
cd graphini
pnpm installpnpm dev # Vite dev server
pnpm dev:node # With Node adapter (self-host preview)
pnpm build # Production build
pnpm preview # Preview production buildOpen http://localhost:3000.
Apply schema and migrations from database/:
psql "$DATABASE_URL" -f database/schema.sql
psql "$DATABASE_URL" -f database/v2-schema.sql
psql "$DATABASE_URL" -f database/add-app-settings.sql
psql "$DATABASE_URL" -f database/add-admin-settings.sql
psql "$DATABASE_URL" -f database/add-files-persistence.sql
psql "$DATABASE_URL" -f database/add-files-support.sql
psql "$DATABASE_URL" -f database/add-user-memories.sql
psql "$DATABASE_URL" -f database/add-gemini-provider.sql
psql "$DATABASE_URL" -f database/performance-indexes.sqldocker-compose up --buildA Dockerfile, docker-compose.yml, and nginx.conf are shipped in the repo β self-host on any VPS in under five minutes.
LLM providers and database credentials can be configured via the in-app Settings panel or environment variables. Typical .env:
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/graphini
# Supabase (auth)
PUBLIC_SUPABASE_URL=https://your-project.supabase.co
PUBLIC_SUPABASE_ANON_KEY=eyJ...
SUPABASE_SERVICE_ROLE_KEY=eyJ...
# AI providers β set whichever you use
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
OPENROUTER_API_KEY=sk-or-...
GEMINI_API_KEY=...Graphini ships an OpenAPI 3 spec at api/openapi.yaml. Import it into Postman, Insomnia, or any OpenAPI client to drive Graphini from your own tools or CI.
graphini/
βββ api/
β βββ openapi.yaml # Public OpenAPI spec
βββ database/ # SQL schema + migrations
β βββ schema.sql
β βββ v2-schema.sql
β βββ add-files-persistence.sql
β βββ add-user-memories.sql
β βββ add-gemini-provider.sql
β βββ add-admin-settings.sql
β βββ add-app-settings.sql
β βββ performance-indexes.sql
βββ docs/ # Additional docs
βββ scripts/
β βββ build-aws-icon-pack.mjs # Pre-build AWS icon bundling
βββ src/
β βββ app.css Β· app.html Β· hooks.server.ts
β βββ lib/
β β βββ components/ # UI components
β β βββ features/
β β β βββ chat/ # AI chat loop
β β β βββ diagram/ # Mermaid rendering + store
β β β βββ editor/ # Code editor surface
β β β βββ structurizr/ # C4 model / Structurizr DSL
β β β βββ history/ # Per-file history
β β β βββ icons/ # Icon pack loaders
β β βββ server/ # Server-only utilities
β β βββ stores/ # Svelte stores
β β βββ themes/ # Theming
β β βββ design-tokens.ts
β β βββ constants.ts
β β βββ util/
β βββ routes/
β β βββ dashboard/
β β βββ workspace/
β β βββ edit/
β β βββ view/
β β βββ canvas/
β β βββ admin/
β β βββ api/ # SvelteKit API endpoints
β βββ types/
βββ static/ # Logo, demo images, favicons, brand, AWS icons
βββ tests/ # E2E test suites
βββ Dockerfile
βββ docker-compose.yml
βββ netlify.toml
βββ nginx.conf
βββ svelte.config.js
βββ vite.config.js
βββ drizzle.config.ts
βββ playwright.config.ts
βββ tailwind.config.js
pnpm test # Unit + E2E
pnpm test:unit # Vitest
pnpm test:unit:ui # Vitest UI
pnpm test:unit:coverage
pnpm test:e2e # Playwright
pnpm test:e2e:ui # Playwright UI
pnpm test:e2e:debug # Playwright debug- Mermaid diagram generation from natural language
- Structurizr DSL / C4 model support
- AWS icon pack
- Multi-provider AI (OpenAI Β· Anthropic Β· OpenRouter Β· Gemini)
- User memories across sessions
- File persistence + workspace
- Admin panel
- Public OpenAPI spec
- Docker self-host
- Realtime multi-user collaboration on a single diagram
- Azure + GCP icon packs
- Export to PNG / SVG / PDF with one click
- VS Code extension
- Diagram diffing in PRs (GitHub App)
- Template gallery (system design, onboarding, infra, CI/CD)
Got an idea? Open an issue or start a discussion.
Contributions are what make open source amazing. Any contribution you make is greatly appreciated.
- Fork the project
- Create your feature branch β
git checkout -b feature/amazing-feature - Commit your changes β
git commit -m 'Add amazing feature' - Push to the branch β
git push origin feature/amazing-feature - Open a Pull Request
π New here? Look for good first issue labels.
MIT Β© Omkar Bhad
- Mermaid.js β the text-first diagramming engine that makes this possible
- Structurizr β for the C4 model and DSL
- SvelteKit β the framework
- Vercel AI SDK β unified LLM gateway
- Supabase β auth
- Drizzle ORM β typed SQL
- AWS Architecture Icons β cloud diagram fidelity
Built with β€οΈ for anyone who believes diagrams belong in git.


