Skip to content

mamertofabian/mermaid-diagram-editor

Repository files navigation

๐Ÿงœโ€โ™€๏ธ Mermaid Diagram Editor

A modern, feature-rich web-based editor for creating and managing Mermaid diagrams with real-time preview, cross-device sync, and advanced export capabilities.

๐Ÿš€ Live Demo

Try it now: mermaid.codefrost.dev

Mermaid Diagram Editor Screenshot

โœจ Features

๐ŸŽจ Editor & Preview

  • ๐Ÿ“Š Real-time Mermaid diagram rendering with live preview
  • ๐Ÿ“ Smart code editor with auto-save functionality
  • ๐Ÿ” Advanced zoom & pan controls (mouse wheel + drag)
  • ๐Ÿ“บ Full-screen preview mode for distraction-free viewing
  • ๐ŸŽจ Light/Dark theme support with optimal contrast
  • ๐Ÿ–ฑ๏ธ Enhanced panning: Right-click always enabled, left-click toggleable

๐Ÿ’พ Cross-Device Sync & Storage

  • ๐Ÿ”— URL-based sharing - Generate shareable links for any diagram
  • ๐Ÿ“ File import/export - Support for .mmd and .json backup files
  • ๐Ÿ—‚๏ธ Drag & drop import - Simply drop files to import diagrams
  • ๐Ÿ“‹ Smart paste detection - Paste Mermaid code to auto-create diagrams
  • ๐Ÿ’พ Auto-backup system - Export all diagrams as JSON backup

๐Ÿš€ Export & Print

  • ๐Ÿ“„ Multi-format export: PDF, PNG, SVG, MMD
  • ๐Ÿ–จ๏ธ Print optimization - Clean, centered printing via Ctrl+P
  • ๐Ÿ“ฑ Enhanced mobile controls - 2-row layout with expandable export options
  • โšก High-quality exports with proper scaling and backgrounds
  • ๐ŸŽฎ Smooth animations - Fluid sidebar transitions and control animations

๐ŸŽฏ User Experience

  • โœจ Custom modal system - No ugly browser alerts/confirms
  • ๐ŸŽ‰ Interactive welcome guide - Comprehensive feature overview
  • ๐Ÿ“‚ Smart diagram management - Create, rename, delete, organize
  • ๐Ÿ”„ Persistent state - Remembers your preferences and diagrams
  • ๐ŸŒ No login required - Works completely offline after first load

๐Ÿ—‚๏ธ Collections & Organization

  • ๐Ÿ“ Collection management - Create, edit, and delete collections
  • ๐ŸŽจ Customizable collections - Choose colors and icons for visual organization
  • ๐Ÿ–ฑ๏ธ Drag & drop organization - Simply drag diagrams to collections
  • ๐Ÿ”— Multi-collection support - Diagrams can belong to multiple collections
  • ๐Ÿท๏ธ Visual collection badges - See which collections a diagram belongs to

Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Installation

  1. Clone the repository:
git clone https://github.com/mamertofabian/mermaid-diagram-editor.git
cd mermaid-diagram-editor
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev

The application will be available at http://localhost:5173

๐Ÿ“– Usage

๐Ÿ†• Creating Diagrams

  1. New Diagram: Click the '+' button in the sidebar
  2. Smart Paste: Copy Mermaid code and paste anywhere - automatically creates a new diagram
  3. Import Files: Drag & drop .mmd or .json files, or use the Import button

โœ๏ธ Editing & Viewing

  1. Live Editing: Write Mermaid syntax and see real-time preview
  2. View Modes: Toggle between code and preview modes (eye/code icons)
  3. Auto-Save: All changes are automatically saved as you type

๐Ÿ” Navigation & Controls

  • Zoom: Mouse wheel or +/- buttons
  • Pan: Left-click drag (toggleable) or right-click drag (always enabled)
  • Full-screen: Click expand icon for distraction-free viewing
  • Themes: Switch between light/dark themes for optimal contrast
  • Mobile: 2-row control layout with expandable export buttons and smooth animations

๐Ÿ”— Sharing & Export

  • Share: Click share icon to generate URL and copy to clipboard
  • Export Single: Export individual diagrams as .mmd files
  • Export All: Backup all diagrams as JSON file
  • Print: Use Ctrl+P for clean, diagram-only printing
  • Multi-format: Export as PDF, PNG, or SVG

๐Ÿ—‚๏ธ Collections & Organization

  • Create Collections: Click the "Collection" button to create new collections
  • Customize: Choose colors and icons for each collection
  • Drag & Drop: Simply drag any diagram to a collection header to add it
  • Multi-collection: Diagrams can belong to multiple collections
  • Visual Feedback: Clear indicators show valid drop zones and prevent duplicate additions
  • Manage: Edit or delete collections using the buttons in each collection header

๐Ÿ› ๏ธ Built With

  • Frontend: React 18 + TypeScript
  • Build Tool: Vite (for fast development and optimized builds)
  • Diagram Engine: Mermaid.js (latest version)
  • Styling: Tailwind CSS (utility-first CSS framework)
  • Icons: Lucide React (beautiful, customizable icons)
  • Export: jsPDF + html2canvas (high-quality exports)
  • Storage: Browser localStorage (no backend required)

๐ŸŽฏ Architecture

  • Component-based: Modular React components with TypeScript
  • Service Layer: Separate services for storage, import/export, and utilities
  • State Management: React hooks (useState, useEffect) - no external state library needed
  • Theme System: CSS-in-JS with Tailwind for consistent theming
  • File Handling: Native File API with drag & drop support
  • URL Encoding: Base64 encoding with Unicode support for sharing

๐Ÿ‘จโ€๐Ÿ’ป About the Author

Mamerto Fabian
Founder & AI Solutions Architect
Codefrost | AI-Driven Coder

Book Consultation YouTube Codefrost

GitHub Portfolio

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style and TypeScript patterns
  • Add comments for complex logic
  • Test your changes thoroughly
  • Update documentation if needed

๐Ÿ› Bug Reports & Feature Requests

Found a bug or have a feature idea? Please open an issue with:

  • Clear description of the problem/feature
  • Steps to reproduce (for bugs)
  • Screenshots if applicable
  • Your environment details

โญ Show Your Support

If this project helped you, please consider:

  • โญ Starring the repository
  • ๐Ÿฆ Sharing it on social media
  • ๐Ÿ“ Writing a blog post about it
  • โ˜• Supporting the developer

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿš€ Try the Live Demo | ๐Ÿ’ป View Source | ๐Ÿ“… Book Consultation

Built with โค๏ธ by Mamerto Fabian at Codefrost

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages