How harsha943vf/code_galaxy works
CodeGalaxy combines a browser-based collaborative coding workspace with authentication and an AI-assisted study planner. Users enter through the routed React app, then can register or log in, work in shared editor rooms, exchange collaboration events, and execute code; separately, authenticated learners generate and manage study plans with AI-created quizzes, explanations, and resources. The server excerpt shows the HTTP and Socket.io entry points and their responsibilities; the client’s broader wiring is only partly sampled, so some documented feature links are not asserted as direct calls.
Main entry points: studyPlan.ts Study plan endpoints · server.ts HTTP and socket server · App.tsx Route application · FileContext.tsx Shared file state
Components 23
Web client
- Route application
client/src/App.tsx - Login and registration
client/src/pages/RegisterPage.tsx - Auth context hook
client/src/hooks/useAuth.ts
Collaborative editor
- Editor room page
client/src/pages/EditorPage.tsx - Shared file state
client/src/context/FileContext.tsx - Code editor
client/src/components/editor/Editor.tsx - Room chat
client/src/components/chats/ChatInput.tsx - Socket state
client/src/context/SocketContext.tsx - Code execution state
client/src/context/RunCodeContext.tsx - Compiler API client
client/src/api/oneCompiler.ts
API and persistence
- HTTP and socket server
server/src/server.ts - Auth endpoints
server/src/routes/auth.ts - JWT verification
server/src/middleware/auth.ts - User records
server/src/models/User.ts - MongoDB connection
server/src/config/database.ts
Study planner
- Study plan pages
client/src/pages/StudyPlannerPage.tsx - Plan details
client/src/pages/StudyPlanDetailsPage.tsx - Study plan endpoints
server/src/routes/studyPlan.ts - AI study generation
server/src/services/studyPlanService.ts - Study plan records
server/src/models/StudyPlan.ts
Other components
- Visitor or learner
- Gemini AI
- OneCompiler
Connections 28
- Visitor or learner → Route application: opens
client/src/App.tsx - Route application → Login and registration: routes to
client/src/App.tsx - Route application → Editor room page: routes to
client/src/App.tsx - Route application → Study plan pages: routes to
client/src/App.tsx - Route application → Plan details: routes to
client/src/App.tsx - Login and registration → Auth context hook: uses
client/src/hooks/useAuth.ts - Login and registration → Auth endpoints: requests auth
- HTTP and socket server → Auth endpoints: mounts routes
server/src/server.ts - Auth endpoints → JWT verification: verifies token
server/src/routes/auth.ts - Auth endpoints → User records: reads and writes
server/src/routes/auth.ts - HTTP and socket server → MongoDB connection: connects
server/src/server.ts - Editor room page → Shared file state: uses workspace state
- Shared file state → Code editor: supplies file state
- Editor room page → Room chat: offers room chat
- Shared file state → Socket state: emits sync events
client/src/context/FileContext.tsx - Socket state → HTTP and socket server: exchanges room events
server/src/server.ts - Code execution state → Shared file state: reads active files
client/src/context/RunCodeContext.tsx - Code execution state → Compiler API client: requests execution
- Compiler API client → HTTP and socket server: posts compile request
- HTTP and socket server → OneCompiler: forwards code
server/src/server.ts - Study plan pages → Study plan endpoints: requests plans
- Plan details → Study plan endpoints: requests plan details
- HTTP and socket server → Study plan endpoints: mounts routes
server/src/server.ts - Study plan endpoints → JWT verification: requires authentication
server/src/routes/studyPlan.ts - Study plan endpoints → AI study generation: generates learning content
server/src/routes/studyPlan.ts - AI study generation → Gemini AI: generates content
server/src/services/studyPlanService.ts - Study plan endpoints → Study plan records: loads and saves plans
server/src/routes/studyPlan.ts - Study plan endpoints → Study plan pages: returns plan results