Excalidraw Studio
Generate, edit and export Excalidraw diagrams from chat with live streaming and persistent workspaces
Ask AI about Excalidraw Studio
Powered by Claude Β· Grounded in docs
I know everything about Excalidraw Studio. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Excalidraw Studio
Describe anything and watch it draw itself in chat, element by element. Refine it in chat or open it as a full Excalidraw canvas β draw more yourself, bring it back, keep iterating. Powered by CopilotKit and a custom Excalidraw MCP server.
https://github.com/user-attachments/assets/4cdf3662-4b02-4df6-9e2c-66518be7ea79
What It Does
- Live diagram rendering : diagrams draw themselves inside chat as the AI responds, element by element.
- Local Canvas : every diagram has a "workspace" button. Click it and the canvas opens locally β drag, reshape, annotate, connect freely.
- Workspaces : every diagram auto-saves. Browse, rename, and delete all your saved diagrams from the Workspaces page. Each one is a checkpoint you can return to anytime.
- Blank canvas : create an empty canvas from Workspaces, draw something yourself, then bring it back to chat to edit with AI.
- Edit with AI : open any saved workspace, hit "Edit with AI" and the diagram loads straight into chat context. Describe changes and they sync back to the workspace.
- Five diagram modes : Architecture, Sequence Diagram, Wireframe, Freehand Sketch, and Storyboard. Your choice persists across sessions.
- Export : download as PNG, JPEG, or SVG, or copy to clipboard directly from the chat toolbar. Zoom and expand inline without leaving chat.
- No database required : everything saves to disk by default. Redis is supported for Vercel deployments.
Quick Start
# install dependencies
npm install
cd server && npm install && npm run build && cd ..
# run both servers
npm run dev # starts Next.js (port 3000) and MCP server (port 3001) together
Create .env.local in the root and add your OpenAI API key.
OPENAI_API_KEY=sk-proj-...
Diagram Styles
Open Settings (gear icon, top-right) to switch styles. Your choice is saved across sessions.
| Style | Best for |
|---|---|
| Architecture | System design, layers, component relationships |
| Sequence Diagram | API flows, call chains, actor interactions |
| Wireframe | Lo-fi UI mockups in grayscale |
| Freehand Sketch | Quick concept maps, whiteboard-style ideas |
| Storyboard | Step-by-step narratives, user flows, comic-strip format |
Switching Models
Pass any model string to BuiltInAgent in src/app/api/copilotkit/route.ts.
// Anthropic
const agent = new BuiltInAgent({ model: "anthropic:claude-sonnet-4-6" });
// Google
const agent = new BuiltInAgent({ model: "google:gemini-2.5-flash" });
Add the matching API key to .env.local (e.g. ANTHROPIC_API_KEY=sk-ant-...). For Azure OpenAI, AWS Bedrock, Ollama and other providers, see the model selection docs.
How It Works
βββ src/
β βββ app/
β β βββ page.tsx β chat UI, skill picker, welcome screen
β β βββ workspace/[id]/ β full Excalidraw editor
β β βββ workspaces/ β saved diagrams list
β β βββ api/copilotkit/ β CopilotKit runtime and agent
β β βββ api/checkpoints/ β list all saved checkpoints
β β βββ api/checkpoint/[id]/ β get, update, delete a checkpoint
β βββ components/
β β βββ mcp-widget-zoom.tsx β toolbar injection (zoom, expand, export)
β β βββ inline-agent-status.tsx β replaces CopilotKit spinner with contextual labels
β βββ lib/
β β βββ prepare-elements.ts β converts shorthand elements + restores fonts before render
β βββ skills/ β system prompts for each diagram style
βββ server/
βββ src/
βββ main.ts β HTTP server
βββ server.ts β MCP tools (read_me, create_view)
βββ mcp-app.tsx β widget: SVG rendering, reveal animation
βββ checkpoint-store.ts β file, memory, and Redis storage
The agent calls create_view on the MCP server with a JSON array of Excalidraw elements. The server saves them as a checkpoint and returns an iframe widget. CopilotKit renders that iframe in chat via the MCP Apps protocol. The widget replays the elements one by one, calling exportToSvg and diffing the DOM with morphdom for a live drawing effect.
Each checkpoint is a JSON file on disk (default) or in Redis (Vercel), keyed by an 18-char ID. Opening "Edit with AI" from a workspace loads the checkpoint into chat context, auto-renders the current diagram, and syncs any AI edits back to the workspace.
Stack
| Chat UI | CopilotKit v2 β CopilotChat, MCPAppsMiddleware |
| Agent | BuiltInAgent connecting directly to LLM |
| Diagram rendering | @excalidraw/excalidraw β exportToSvg + morphdom |
| MCP transport | @modelcontextprotocol/sdk Streamable HTTP |
| Storage | File system (local) / Upstash Redis (Vercel) |
| Frontend | Next.js 16, Tailwind CSS 4 |
Environment Variables
| Variable | Default | |
|---|---|---|
OPENAI_API_KEY | required | |
MCP_SERVER_URL | http://localhost:3001/mcp | MCP server endpoint |
KV_REST_API_URL | Upstash Redis URL (Vercel) | |
KV_REST_API_TOKEN | Upstash Redis token (Vercel) |
Deploying
The Next.js app deploys to Vercel out of the box. The MCP server runs as a separate service on Docker, Railway, or Render. For Vercel deployments, use the included api/mcp.ts handler with createVercelStore() for Redis-backed persistence.
License
MIT
