A Next.js starter for AI-powered diagram generation. Includes a prompt-to-Mermaid pipeline via the Vercel AI Gateway, a diagram library with slug-based routing, a full settings panel, and dark mode. Fork it, swap the models, extend the data layer.
Your Prompt
Natural language input
API Route
/api/generate-diagram
Vercel AI Gateway
Zero-config routing
AI Model
anthropic/claude-opus-4.6
Mermaid.js
Client-side render
SDK
Vercel AI SDK v6
Gateway
Vercel AI Gateway
Default Model
anthropic/claude-opus-4.6
Temperature
0.3 (deterministic)
Claude Opus 4.6
Most capable model. Best for complex diagram generation with nuanced understanding.
Gemini 3 Flash
Fast and efficient. Great for quick diagram generation.
What You Get
A prompt-to-diagram generator powered by the Vercel AI Gateway. Enter a natural language description, pick a model, and get valid Mermaid syntax back. Includes request logging and syntax preview.
Open GeneratorA pre-built collection of example diagrams stored as data files. Each diagram has a slug-based detail page with full Mermaid rendering. Add new examples by dropping a file into /data.
Browse DiagramsFull configuration UI for the AI pipeline: model selector with tier badges, temperature slider with guidance ranges, editable system prompt, and a visual architecture flow showing how requests are routed.
Open SettingsA reusable MermaidDiagram client component that initializes Mermaid.js, handles errors, and re-renders when the chart prop changes. Strips code fences automatically.
See It RenderA subtle spark animation component that wraps any card. Uses Tailwind keyframes defined in tailwind.config.ts with pointer-events-none so child elements remain interactive.
See on DiagrammerSystem-aware theme toggle using next-themes and Radix UI. Persists preference and updates all shadcn/ui design tokens. Toggle is accessible from the header on every page.
Try Theme ToggleExplore
Diagrammer
Generate a diagram from a prompt using AI
Example Diagrams
Browse pre-built ERD, workflow, and network diagrams
Settings
Configure AI model, temperature, and system prompt
app/page.tsxHomepage / docs overview (this page)app/diagrammer/page.tsxAI-powered diagram generatorapp/api/generate-diagram/route.tsAPI route using Vercel AI SDK generateTextapp/list/page.tsxDiagram library gridapp/list/[slug]/page.tsxIndividual diagram detail pageapp/settings/page.tsxAI configuration and app preferenceslib/ai-config.tsShared AI config: models, prompt, temperature, diagram typesdata/*.tsExample diagram data filescomponents/MermaidDiagram.tsxClient-side Mermaid renderer componentcomponents/AnimatedBorder.tsxSpark animation wrapper componentcomponents/Header.tsxApp header with navigation and theme toggle