An Electron-based macOS application that combines GitHub Copilot SDK with Excalidraw to create an AI-powered drawing assistant. Describe what you want to draw in natural language, and the AI will generate Excalidraw diagrams for you.
- π€ AI-Powered Drawing: Use natural language to describe diagrams and drawings
- βοΈ Excalidraw Integration: Full-featured drawing canvas with Excalidraw
- π¬ Conversational Interface: Interactive chat with streaming responses
- πΎ Session Persistence: Automatic saving of conversations and drawings
- π GitHub Authentication: Secure authentication via GitHub CLI or API key
- π¦ SQLite Storage: Efficient metadata storage with better-sqlite3
- Node.js 18+ and npm
- GitHub CLI (
gh) or GitHub API key with Copilot access - macOS (other platforms may work but are untested)
- Navigate to the project directory:
cd excalidraw-copilot-app- Install dependencies (already done if you followed setup):
npm install- Authenticate with GitHub:
gh auth loginRun the app in development mode with hot-reload:
npm run devThis will:
- Start the Vite dev server on
http://localhost:5173 - Launch Electron with the app
- Open DevTools automatically
Build the app for distribution:
npm run electron:buildThis creates a distributable app in the dist folder.
The app is split into two main processes:
-
Main Process (Electron):
- Manages Copilot SDK client
- Handles authentication
- Stores session data and drawings
- Provides IPC interface
-
Renderer Process (React):
- Chat interface for user interaction
- Excalidraw canvas for drawing
- JSON parser for AI responses
- Real-time updates via IPC
The AI responds with JSON in markdown code blocks:
{
"elements": [
{
"type": "rectangle",
"x": 100,
"y": 100,
"width": 200,
"height": 150,
"text": "Server",
"strokeColor": "#000000",
"backgroundColor": "#ffffff"
},
{
"type": "arrow",
"startX": 300,
"startY": 175,
"endX": 500,
"endY": 175
}
]
}Supported element types:
rectangle,ellipse,diamond: Shapes with optional textarrow,line: Connectors between elementstext: Standalone text labels
- Copilot Sessions: Managed by SDK (stored in
XDG_STATE_HOME) - Excalidraw Scenes: JSON files in
~/Library/Application Support/excalidraw-copilot-app/drawings/ - Session Metadata: SQLite database in user data directory
Try these prompts with the AI:
- "Draw a simple flowchart with start, process, and end boxes"
- "Create a system architecture diagram with 3 servers connected to a load balancer"
- "Make a mind map about project planning"
- "Draw a sequence diagram showing a user login flow"
- "Create an org chart with 5 team members"
excalidraw-copilot-app/
βββ electron/ # Main process code
β βββ main.ts # Entry point
β βββ auth.ts # Authentication manager
β βββ copilot.ts # Copilot SDK wrapper
β βββ storage.ts # SQLite + file storage
β βββ preload.ts # IPC bridge
βββ src/ # Renderer process code
β βββ components/ # React components
β β βββ ChatPanel.tsx # Chat interface
β β βββ ChatPanel.css
β βββ utils/ # Utilities
β β βββ parser.ts # JSON parser & converter
β βββ types/ # TypeScript definitions
β βββ App.tsx # Main app component
β βββ App.css
β βββ main.tsx # React entry point
βββ index.html # HTML entry
βββ vite.config.ts # Vite configuration
βββ tsconfig.json # TypeScript config
βββ package.json
The vite.config.ts includes:
- React plugin for JSX/TSX support
- Electron plugin for main process compilation
- Electron renderer plugin for preload script
Two tsconfig files:
tsconfig.json: Main TypeScript config for src and electrontsconfig.node.json: Config for Vite and build tools
If you see authentication errors:
- Verify GitHub CLI is installed:
gh --version - Check authentication status:
gh auth status - Re-authenticate:
gh auth login
If you encounter build errors:
- Clear node_modules:
rm -rf node_modules && npm install - Clear Vite cache:
rm -rf node_modules/.vite - Check Node version:
node --version(should be 18+)
If the canvas doesn't appear:
- Check browser console for errors
- Verify Excalidraw package is installed:
npm ls @excalidraw/excalidraw - Try restarting the dev server
npm testnpm run lintnpx tsc --noEmit- Authentication: Uses GitHub CLI credentials stored securely by gh
- IPC: Context isolation enabled in preload script
- Node Integration: Disabled in renderer for security
- Storage: Session data stored in user's protected app data directory
- Currently optimized for macOS (Windows/Linux untested)
- Requires active GitHub Copilot subscription
- Drawing complexity limited by AI model capabilities
- No real-time collaboration features
- Windows and Linux support
- Export drawings as PNG/SVG
- Undo/redo with full scene history
- Custom element templates
- Multi-session tab interface
- Improved AI prompt engineering
- Error recovery and retry logic
- Performance optimizations for large drawings
ISC
Contributions welcome! Please open issues for bugs or feature requests.