A modern, cyberpunk-themed live editor for creating beautiful Mermaid.js diagrams with AI assistance
- β¨ Features
- π Tech Stack
- β‘ Quick Start
- π§ Installation
- π Environment Setup
- π― Usage Guide
- π API Documentation
- ποΈ Project Structure
- π€ Contributing
- π License
- Cyberpunk Aesthetic: Neon colors, futuristic interface with glitch effects
- Dark/Light Theme: Seamless theme switching with system preference detection
- Responsive Design: Optimized for desktop, tablet, and mobile devices
- Split-pane Layout: Resizable editor and preview panels
- Live Preview: Instant diagram rendering as you type
- Syntax Highlighting: Monaco Editor with Mermaid syntax support
- Auto-completion: Intelligent code suggestions and snippets
- Error Detection: Real-time syntax validation and error highlighting
- Smart Error Correction: Fix Mermaid.js syntax errors with Google Gemini AI
- Code Optimization: AI-powered suggestions for better diagram structure
- Natural Language Processing: Convert text descriptions to Mermaid diagrams
- Context-aware Assistance: Intelligent help based on current diagram type
- Multiple Formats: Export to PNG, JPG, SVG, and PDF
- High-quality Output: Vector and raster formats with customizable resolution
- Cloud Storage: Save and sync diagrams with Supabase backend
- Version History: Track changes and restore previous versions
- Secure API Management: Encrypted storage of API keys
- Row-level Security: User data isolation with Supabase RLS
- Local Storage: Option to work offline without cloud sync
- No Data Collection: Privacy-first approach with minimal tracking
- React 18 - Modern React with Hooks and Concurrent Features
- TypeScript 5 - Type-safe development with latest TS features
- Vite 5 - Lightning-fast build tool and dev server
- Tailwind CSS 3 - Utility-first CSS framework
- Shadcn/ui - Beautiful, accessible component library
- Monaco Editor - VS Code's editor with full IntelliSense
- Mermaid.js - Diagram and flowchart generation
- React Flow - Interactive node-based diagrams
- Lucide React - Beautiful, customizable icons
- Supabase - Open-source Firebase alternative
- PostgreSQL - Robust relational database
- Google Gemini API - Advanced AI language model
- Vercel - Deployment and hosting platform
- Bun - Fast JavaScript runtime and package manager
- ESLint - Code linting and quality assurance
- Prettier - Code formatting and style consistency
- Husky - Git hooks for pre-commit validation
# Clone the repository
git clone https://github.com/danielxxomg2/mermaid-flow-ai.git
cd mermaid-flow-ai
# Install dependencies
bun install
# Set up environment variables
cp .env.example .env
# Edit .env with your Supabase credentials
# Start development server
bun run dev
π Open http://localhost:5173 to see the app!
- Node.js 18+ or Bun 1.0+
- Git for version control
- Supabase Account (free tier available)
- Google AI Studio Account (for Gemini API)
-
Clone the repository
git clone https://github.com/danielxxomg2/mermaid-flow-ai.git cd mermaid-flow-ai
-
Install dependencies
# Using Bun (recommended) bun install # Or using npm npm install # Or using yarn yarn install
-
Set up environment variables
cp .env.example .env
-
Configure your environment (see Environment Setup)
-
Run database migrations (if using Supabase)
bunx supabase db push
-
Start the development server
bun run dev
Create a .env
file in the root directory:
# Supabase Configuration
VITE_SUPABASE_URL=your_supabase_project_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
# Optional: Google Gemini API (for AI features)
VITE_GEMINI_API_KEY=your_gemini_api_key
- Create a Supabase project at supabase.com
- Get your project URL and anon key from Settings β API
- Run the database migration:
-- Copy and paste the contents of supabase/migrations/001_initial_schema.sql -- into your Supabase SQL editor
- Visit Google AI Studio
- Create an API key for Gemini
- Add the key to your
.env
file
We're working on Docker support to make deployment even easier! This will include:
- Multi-stage Docker builds for optimized production images
- Docker Compose setup with Supabase integration
- Environment variable management for containerized deployments
- Health checks and monitoring capabilities
- Kubernetes manifests for scalable deployments
Expected features:
# Quick start with Docker (Coming Soon)
docker-compose up -d
# Or with Docker
docker run -p 3000:3000 danielxxomg2/mermaid-flow-ai
π ETA: Q2 2024 - Stay tuned for updates!
-
π Write Mermaid Code
- Use the left panel Monaco editor
- Enjoy syntax highlighting and auto-completion
- Try different diagram types (flowchart, sequence, class, etc.)
-
π Real-time Preview
- See your diagram render instantly in the right panel
- Zoom, pan, and interact with the diagram
- Responsive layout adapts to your screen size
-
π€ AI Assistance
- Click the AI button when you encounter errors
- Get intelligent suggestions for improvements
- Convert natural language to Mermaid syntax
-
πΎ Save & Export
- Save diagrams to your Supabase account
- Export in multiple formats (PNG, SVG, PDF)
- Share diagrams with public links
- Flowcharts - Process flows and decision trees
- Sequence Diagrams - System interactions over time
- Class Diagrams - Object-oriented design
- State Diagrams - State machines and transitions
- Entity Relationship - Database schemas
- User Journey - User experience flows
- Gantt Charts - Project timelines
- Pie Charts - Data visualization
- Git Graphs - Version control workflows
Shortcut | Action |
---|---|
Ctrl/Cmd + S |
Save diagram |
Ctrl/Cmd + Z |
Undo |
Ctrl/Cmd + Y |
Redo |
Ctrl/Cmd + / |
Toggle comments |
F11 |
Toggle fullscreen |
Ctrl/Cmd + E |
Export diagram |
Ctrl/Cmd + K |
Open command palette |
diagrams
- Store user diagramsdiagram_versions
- Version historyapi_keys
- Encrypted API key storage
All tables implement RLS policies to ensure users can only access their own data.
// Example: Using the AI service
import { aiService } from './services/aiService';
const correctedCode = await aiService.correctMermaidSyntax(
'graph TD\n A -> B',
'The arrow syntax is incorrect'
);
mermaid-flow-ai/
βββ π public/ # Static assets
βββ π src/
β βββ π components/ # React components
β β βββ CodeEditor.tsx # Monaco editor wrapper
β β βββ DiagramViewer.tsx # Mermaid diagram renderer
β β βββ Toolbar.tsx # Main toolbar
β β βββ SettingsModal.tsx # Configuration modal
β β βββ ExportModal.tsx # Export options modal
β βββ π hooks/ # Custom React hooks
β β βββ useHistory.ts # Undo/redo functionality
β β βββ useTheme.ts # Theme management
β βββ π lib/ # Utility libraries
β β βββ supabase.ts # Supabase client
β β βββ utils.ts # Helper functions
β βββ π services/ # External service integrations
β β βββ aiService.ts # Google Gemini API
β βββ π store/ # State management
β β βββ useStore.ts # Zustand store
β βββ π pages/ # Page components
β β βββ Home.tsx # Main application page
β βββ App.tsx # Root component
β βββ main.tsx # Application entry point
β βββ index.css # Global styles
βββ π supabase/ # Database schema
β βββ migrations/ # SQL migration files
βββ .env.example # Environment variables template
βββ package.json # Dependencies and scripts
βββ tailwind.config.js # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite build configuration
βββ vercel.json # Vercel deployment config
App.tsx
- Main application component with state managementCodeEditor.tsx
- Monaco editor with Mermaid syntax highlightingDiagramViewer.tsx
- Mermaid diagram renderer with zoom/panaiService.ts
- Google Gemini API integration for error correctionuseStore.ts
- Centralized state management with Zustand
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Run tests and linting
bun run lint bun run type-check
- Commit your changes
git commit -m 'feat: add amazing feature'
- Push to your branch
git push origin feature/amazing-feature
- Open a Pull Request
We use Conventional Commits:
feat:
- New featuresfix:
- Bug fixesdocs:
- Documentation changesstyle:
- Code style changesrefactor:
- Code refactoringtest:
- Test additions or changeschore:
- Maintenance tasks
- Use TypeScript for all new code
- Follow ESLint and Prettier configurations
- Write meaningful commit messages
- Add JSDoc comments for complex functions
- Ensure responsive design for new UI components
- Write unit tests for new utilities and hooks
- Test components with React Testing Library
- Ensure cross-browser compatibility
- Test responsive design on multiple screen sizes
Found a bug? Please create an issue with:
- Clear description of the problem
- Steps to reproduce the issue
- Expected vs actual behavior
- Browser and OS information
- Screenshots if applicable
Have an idea? We'd love to hear it! Please include:
- Clear description of the feature
- Use case and benefits
- Mockups or examples if applicable
This project is licensed under the MIT License - see the LICENSE file for details.
- β Commercial use - Use in commercial projects
- β Modification - Modify the source code
- β Distribution - Distribute the software
- β Private use - Use for private projects
- β Liability - No warranty or liability
- β Warranty - No warranty provided
Made with β€οΈ by the Mermaid Flow AI team
- Mermaid.js - Amazing diagram generation library
- Monaco Editor - Powerful code editor
- Supabase - Open-source backend platform
- Google Gemini - Advanced AI language model
- Shadcn/ui - Beautiful component library
- Tailwind CSS - Utility-first CSS framework