How codemaster17/pathfiller-online-codeeditor-and-compiler works
Project type and purpose
• Pathfiller is a full‑stack, interactive coding platform comprising two main experiences:
• Coding Playground – free‑form code editing and execution with custom inputs
• Coding Arena – timed/problem‑driven code challenges with test‑case validation
• Frontend: React + TypeScript + Tailwind + CodeMirror, deployed on Vercel
• Backend: Node/Express (TypeScript) exposing REST endpoints
• Data stores: MongoDB (problems, users, submissions, profiles, tags, test cases), Redis for Bull job queues
• Code execution: child_process invoked by worker processes
File structure
• Top‑level “frontend” folder: Vite/React app, includes schema (Zod), API clients, components, pages, Redux store, routing, assets
• Top‑level “express_backend” folder: src/ & dist/ code, controllers, routers, services, models, utils, middleware, queue logic under src/code
• Config files: tsconfig, nodemon.json, ecosystem.config (PM2), vercel.json
• Infrastructure indicators: Mongoose (models), Bull (job_queue.ts), Redis client, child_process scripts (executePy.ts, execute_cpp.ts)
README for additional insights
• Tech stack enumerated (MongoDB, Bull, child_process, Mongoose)
• Emphasis on scalability, security, message‑queue patterns
a. Main components to include
• User’s Browser (React SPA)
• Frontend App (API layer)
• Backend API Server (Express.js)
• Job Queue (Bull on Redis)
• Worker Service(s) (Node.js processes executing code)
• Data Store (MongoDB cluster)
• Child_Process Executor (OS sandbox invoked by worker)
• (Optional) CDN / Vercel Layer
b. Relationships & interactions
1. Browser → Frontend App (HTTP/Fetch)
2. Frontend → Backend API (REST endpoints: /api/problems, /api/code, /api/playground, /api/user)
3. Backend → MongoDB (via Mongoose ORM) for reads/writes
4. Backend → Redis/Bull Enqueue (job submissions)
5. Worker ← Bull Queue (job intake)
6. Worker → Child_Process sandbox (compile & run code)
7. Child_Process → Worker (stdout, stderr, metrics)
8. Worker → MongoDB (store result, execution logs)
9. Frontend polls or retrieves job status via API (Backend → Mongo)
c. Architectural patterns & design principles
• Separation of concerns: UI vs API vs Worker
• Asynchronous processing with message queue (Bull) for heavy CPU‑bound tasks
• MVC‑style controllers & routers in backend; React components/pages in frontend
• Centralized error handling via middleware
• Config driven (environment variables, tsconfig, vercel.json)
d. Key technologies/frameworks
• Frontend: React, TypeScript, Tailwind, Shadcn/Magic UI, CodeMirror, Redux
• Backend: Express.js, TypeScript, Mongoose, Bull, Redis client, child_process
• Data stores: MongoDB Atlas, Redis instance
• Deployment: Vercel (frontend), PM2/ecosystem.config or Vercel Serverless (backend)
Detailed capture of essential elements
• Don’t just show “Backend” – break it into Router → Controller → Service → Model
• Code_execution flow: generateFile.ts → job_queue.ts → executePy/execute_cpp → store results
• External dependencies: MongoDB cluster, Redis server, child_process sandbox