How blnwajith/compiler works
Project type and purpose
• This is a full-stack, web-based code editor and compiler with AI-powered assistance.
• Purpose: let users edit, compile, run multi-language code and interact with a local AI model for explanations, bug detection, and improvements.
File structure
• Top-level directories:
• client/ – React/Vite frontend and Monaco editor
• server/ – Node.js + Express backend, proxies to Piston API
• compiler/ – Python Flask AI service loading a HuggingFace model
• Other files:
• huggingface.py – model loading & analysis logic
• all_runtimes.json – supported languages list for Piston
• test/version scripts and helper scripts (check_versions.js, verify_mock.js)
• No database or persistent store; stateless request/response architecture with external API calls.
Key insights from the README
• Frontend: React, Vite, Monaco Editor, Axios
• Backend: Node.js, Express, Piston API for code execution
• AI service: Python, Flask, HuggingFace Transformers, PyTorch
• Three distinct services start in parallel: AI (port 5000), Backend (port 3000), Frontend (port 5173).
a. Main components
• User’s Browser (UI)
• Frontend App (React + Monaco Editor)
• Backend Service (Node.js + Express)
• AI Service (Python + Flask + HuggingFace model)
• External Code Execution API (Piston)
b. Relationships & interactions
1. User interacts with the React UI in browser.
2. On “Run Code,” UI issues HTTP POST to Backend → Backend calls Piston API → Backend returns compile/run results → UI displays output.
3. On “Chat” or AI request, UI issues HTTP POST to AI Service → Flask loads model (Qwen2.5) → model analysis → AI Service returns explanation/feedback → UI updates chat panel.
c. Architectural patterns & design principles
• Microservices style: three independent services communicating over HTTP.
• Clear separation of concerns: UI vs. business logic vs. AI inference.
• Stateless services: each request is self-contained.
d. Relevant technologies
• Frontend: React, Vite, Monaco Editor, Axios
• Backend: Node.js, Express, Piston API
• AI: Python, Flask, HuggingFace Transformers, PyTorch