- Authors
- Name
- Arthur Reimus
- @artreimus

Auto Diagram
Built with โค๏ธ by @artreimus from Ylang Labs
Transform your ideas into beautiful diagrams with the power of AI. Describe any process, architecture, or workflow in natural language and watch it come to life as stunning Mermaid diagrams.
๐ธ Screenshots
Main Interface

Command Suggestions

Generated Diagrams

โจ Features
- ๐ค AI-Powered Diagramming: Describe complex systems, workflows, or ideas in natural language
- ๐ Multi-Chart Generation: Intelligent AI planner creates multiple related diagrams from a single prompt
- โก Chart Command Shortcuts: Type
/flowchart
,/sequence
,/class
and more for quick chart type selection - ๐ AI Mermaid Syntax Fix: Use AI to fix invalid Mermaid syntax for improved reliability
- ๐พ Session Management: Automatic save to local storage with shareable unique URLs
- ๐จ Polished UI: Beautiful, minimalist interface with fluid animations powered by Framer Motion
- ๐ง Multi-Provider Support: Choose from Google Gemini, OpenRouter, Anthropic Claude, or OpenAI
- ๐ Web Search Integration: Enhanced diagram generation with EXA API web search capabilities
- ๐ฑ Responsive Design: Works seamlessly on desktop and mobile devices
๐ Getting Started
Prerequisites
- Node.js (version 20.x or higher)
- At least one AI provider API key (see configuration below)
Installation
Clone the repository
git clone https://github.com/artreimus/auto-diagram.git cd auto-diagram
Install dependencies
npm install
Set up environment variables
cp .env.example .env.local
Configure your API keys (edit
.env.local
)# Choose your preferred AI provider (at least one required) AI_PROVIDER=google # Options: google, openrouter, anthropic, openai # API Keys (at least one required) GOOGLE_GENERATIVE_AI_API_KEY=your_google_api_key_here OPENROUTER_API_KEY=your_openrouter_api_key_here ANTHROPIC_API_KEY=your_anthropic_api_key_here OPENAI_API_KEY=your_openai_api_key_here # Optional: Web search capabilities EXA_API_KEY=your_exa_api_key_here
Start the development server
npm run dev
Open your browser to http://localhost:3000
๐ง Configuration
AI Provider Setup
Choose from four supported AI providers:
Provider | API Key Required | Get Your Key |
---|---|---|
Google Gemini | GOOGLE_GENERATIVE_AI_API_KEY | Get key |
OpenRouter | OPENROUTER_API_KEY | Get key |
Anthropic Claude | ANTHROPIC_API_KEY | Get key |
OpenAI | OPENAI_API_KEY | Get key |
Model Configuration (Optional)
Customize the models used for different tasks:
# Google Models
GOOGLE_FAST_MODEL=gemini-2.5-flash
GOOGLE_REASONING_MODEL=gemini-2.5-pro
# OpenRouter Models
OPENROUTER_FAST_MODEL=mistralai/devstral-small-2505:free
OPENROUTER_REASONING_MODEL=deepseek/deepseek-r1-0528:free
# Anthropic Models
ANTHROPIC_FAST_MODEL=claude-sonnet-4-20250514
ANTHROPIC_REASONING_MODEL=claude-opus-4-20250514
# OpenAI Models
OPENAI_FAST_MODEL=gpt-4o-mini
OPENAI_REASONING_MODEL=o3
๐๏ธ How It Works
The application uses a sophisticated three-phase process:

Phase Details:
- ๐ Planning Phase: AI analyzes your prompt and plans single or multiple diagrams
- Optional web search integration via EXA API for enhanced context
- Intelligent breakdown of complex prompts into multiple related charts
- โก Generation Phase: Fast AI models generate Mermaid syntax for each planned chart
- Parallel processing for multiple charts
- Real-time streaming of generated syntax
- ๐ Correction Phase: User-triggered syntax correction when needed
- Manual activation via fix button when syntax errors occur
- AI-powered error detection and correction
๐ ๏ธ Tech Stack
- Framework: Next.js 15 with App Router
- AI Integration: AI SDK v5 with multiple provider support
- Diagramming: Mermaid.js for interactive diagrams
- UI Components: shadcn/ui with Tailwind CSS
- Animations: Framer Motion for smooth transitions
- Validation: Zod for type-safe schemas
- Environment: @t3-oss/env-nextjs for validated environment variables
- Search: EXA API for web search integration
๐ฆ Deployment
Deploy on Vercel (Recommended)
- Fork this repository
- Connect your fork to Vercel
- Add your environment variables in the Vercel dashboard
- Deploy automatically with every push
Other Platforms
This is a standard Next.js application and can be deployed on any platform that supports Node.js.
๐งช Development
# Start development server with hot reload
npm run dev
# Build for production
npm run build
# Run tests
npm run test
# Run linting
npm run lint
# Format code
npm run format
๐ค Contributing
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name
- Make your changes
- Add tests if applicable
- Run linting and tests
npm run lint npm run test
- Commit your changes
git commit -m 'feat: add some feature'
- Push to your branch
git push origin feature/your-feature-name
- Open a Pull Request
Development Guidelines
- Follow the existing code style and conventions
- Write clear commit messages using conventional commits
- Add tests for new features
- Update documentation as needed
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Mermaid.js for the amazing diagramming library
- AI SDK for the powerful AI integration toolkit
- Vercel for the hosting platform and development tools
- shadcn/ui for the beautiful UI components
Made with โค๏ธ for the developer community