How isavage05/pair_programmer works
Project Type and Purpose
• This is a full-stack AI-Assisted Coding Platform:
• Frontend: React.js application providing pages for task selection, code editing, learning modules, and quizzes.
• Backend: FastAPI service exposing REST endpoints, orchestrating AI-powered features (code hints, generation), code execution, learning content, and quizzes.
• Goal: Let users pick coding tasks, get AI help in real time, run/verify code, and learn via tutorial or quiz modules.
File Structure
• Top-level directories:
• frontend/ – React app (pages, store, public).
• backend/ – FastAPI app (app/main.py, api/routes.py, models/, services/).
• Key backend services:
ai_service.py (interacts with AI model provider)
code_executor.py (runs user code in sandbox)
code_service.py (manages code submission workflow)
learning_service.py & quiz_service.py (generate learning content/quizzes).
• Models directory holds data schemas (Task, etc.).
• Configuration & startup: package.json, requirements.txt, uvicorn command.
Extract Additional Insights from README
• Uses React Context or a store (codingStore.js) for state management across pages.
• Frontend calls backend endpoints for tasks, AI hints, code exec, learning, quizzes.
• Backend dependencies: FastAPI, Pydantic, HTTP client for AI API, sandbox utils.
a. Main Components
• Web Browser (React App)
• React Pages & State Store
• HTTP/HTTPS Layer (API client)
• FastAPI Backend
• Internal Service Layer (AI Service, Code Executor, Learning Service, Quiz Service)
• Data Models & Storage (Task definitions, user progress—could be a database or in-memory store)
• External Systems: AI Model Provider (e.g., OpenAI API), Code Execution Sandbox or Container
b. Relationships & Interactions
1. User interacts with the React App in the browser.
2. React pages dispatch requests via the API service functions to FastAPI endpoints.
3. FastAPI API routes forward calls to the service layer.
4. AI Service contacts the external AI API.
5. Code Executor spins up a sandbox/container to run user code and returns results.
6. Learning & Quiz Services generate content (possibly based on AI or static templates).
7. Services read/write from a data storage layer (database or in-memory cache).
8. Responses flow back up to the frontend for display.
c. Architectural Patterns & Principles
• Layered Architecture: Presentation (React) → API layer → Service layer → Data/External services.
• Separation of Concerns: Each backend service (AI, code execution, content) is decoupled.
• 12-Factor App principles: Config via requirements, package files, environment-agnostic.
• Single-Page Application on front end, RESTful back end.
d. Key Technologies & Frameworks
• Frontend: React.js, React Router (pages), Context/API store (codingStore.js), Axios or fetch in services.
• Backend: FastAPI (uvicorn), Pydantic models, HTTPX or requests for external AI API, Docker or a sandboxing library for code execution.
• Data Storage: PostgreSQL/MySQL/Redis (if present) or file-based/in-memory for Task models.
Essential Details to Capture
• API boundary (REST layer).
• Service orchestration (which service calls which external system).
• Data flow: sequence of request → processing → response.
• Technology annotations (React.js, FastAPI, Pydantic, Docker/sandbox, AI API).
• CI/CD or deployment notes (if applicable—e.g., uvicorn, npm start, Docker build).