How casa-del-dev/bachelor-frontend works
Project type and purpose
• This is a single‐page web application (SPA) built with React, TypeScript, and Vite.
• Its purpose is to deliver an interactive coding/tutorial environment: it manages authentication, code editing/running, problem statements, AI‐powered assistance components, and integration with external services like GitHub or a code‐execution API.
File structure
• Top level:
• index.html + public/ – static entrypoint and assets (e.g. VideoClip.mp4).
• vite.config.ts, tsconfig*.json, eslint.config.js – build, type, and lint configurations.
• routes.json – SPA routing configuration (e.g. for Netlify).
• src/:
• main.tsx – React application bootstrap.
• App.tsx, Layout.tsx – high‐level routing and layout.
• Contexts: ApiContext.tsx, AuthContext.tsx, CodeContext.tsx – state & side‐effect management.
• components/:
– Feature components (AI_Abstract, AI_Check, Problem_detail, Project_files, etc.).
– Auth/UI pages (Login, SignUp, Profile, Welcome).
• No server‐side code here, so all business logic lives client‐side or is delegated to external services.
Extract insights from README
• Provides only the standard Vite + React + TS template instructions.
a. Main components
1) Browser / User’s Device – loads the SPA via index.html.
2) Static Asset Host / CDN – serves built JavaScript, CSS, media from public/ and dist/.
3) React SPA – composed of:
• Presentation Layer: Layout, App, Feature pages (Login, Problem, AI_Editor, etc.).
• UI Components Library: BuildingBlocks/* and shared components.
• Context Layer:
– AuthContext – handles login/logout flows, JWT/storage, token renewal.
– ApiContext – wraps all HTTP calls, injects auth tokens, error handling.
– CodeContext – manages code state, execution requests, results.
4) External Services:
• Authentication Provider (e.g. Auth0, custom API).
• Code Execution API (to compile/run user code).
• GitHub API – accessed by GitHubComponent for repo integration.
• AI Services – e.g. OpenAI for prompts, abstraction, equality checking.
b. Relationships & interactions
• User → Browser → React SPA UI
• UI components dispatch actions to Contexts → Contexts invoke ApiContext or CodeContext
• ApiContext routes calls to Auth Provider, GitHub API, AI endpoints
• CodeContext sends code to Execution API, receives output
• Contexts update global state → UI re‐renders
c. Architectural patterns & design principles
• Component‐Based UI (React function components with CSS modules).
• Context API for state & side effects (avoiding prop drilling).
• Separation of concerns: UI vs. business logic vs. data access.
• Layered architecture: Presentation → Application (contexts) → Infrastructure (API).
d. Key technologies/frameworks
• React 18 + TypeScript + Vite (+ HMR)
• ESLint with recommended & type‐checked rules
• xterm.js (optional) for terminal emulation
• CSS modules / plain .css per component
• Deployment: static hosting (Netlify, Vercel, or S3+CDN)