🚀 Code to Flowchart Generator
An AI-powered desktop application that converts source code into clean, book-style flowcharts using Mermaid syntax. Built with Electron, React, and Express, this tool helps students, developers, and educators visualize program logic across multiple programming languages.
✨ Features
🔍 Automatic Language Detection (C, C++, Java, Python, JavaScript, TypeScript)
🧠 AST-Based Parsing for accurate logic extraction
📊 Mermaid Flowchart Generation (VTU-style formatting)
🎨 Syntax Highlighting using Monaco Editor
💾 Export Options: SVG / PDF
🖥️ Desktop App using Electron
🔌 Modular Backend APIs using Express
🏗️ Tech Stack
Layer Technology
Frontend React + Tailwind CSS Backend Express.js Desktop Electron Editor Monaco Editor Flowcharts Mermaid.js Parsing Custom AST parsers
⚙️ Installation
1️⃣ Clone the repository
git clone https://github.com/karthikc1125/code-to-flowchart-generator.git cd code-to-flowchart-generator
2️⃣ Install dependencies
⚠️ Libraries are not bundled intentionally
cd frontend npm install
cd ../backend npm install
cd ../electron npm install
Start Backend
cd backend npm start
Start Frontend
cd frontend npm run dev
Launch Electron App
cd electron npm start
🔄 Workflow
-
User pastes code into Monaco Editor
-
Language is auto-detected
-
Code is sent to backend API
-
AST parser analyzes structure
-
Logic is converted to Mermaid flowchart
-
Flowchart is rendered visually
🧪 Supported Languages
C
C++
Java
Python
JavaScript
TypeScript
📌 Example Output (Mermaid)
flowchart TD A([start]) --> B[/read n/] B --> C[set i=0] C --> D{i < n} D -->|Yes| E[/print i/] E --> F[i+=1] F --> D D -->|No| G([end])
Detects syntax errors
Shows language-specific error messages
Prevents invalid flowchart generation
🎯 Use Cases
📚 Students learning programming logic
👨🏫 Teachers creating visual explanations
💻 Developers debugging code flow
🧠 Interview preparation
🛠️ Future Improvements
🤖 LLM-based enhancement for complex logic
🌐 Web version deployment
📁 File upload support
🔄 Reverse flowchart → code generation
🤝 Contributing
Contributions are welcome!
-
Fork the repo
-
Create a new branch
-
Make your changes
-
Submit a PR
👨💻 Author
Karthik C Web Development Intern | Full Stack Developer
⭐ Support
If you like this project, give it a ⭐ on GitHub!