How veeravardhan35/hashnet works
Hashnet is a real-time multiplayer coding and learning platform. Learners enter through the React app, authenticate or create/join a room, then play quiz, coding battle, team, or cooperative boss-raid modes; separate competitive-programming and AI-assisted content workflows are also documented. Express serves REST features while Colyseus hosts authoritative game rooms; MongoDB-backed models support accounts and learning content. The excerpts establish routing, room commands, selected controller calls, and RAG forwarding; several feature-level links rely on README documentation because their implementations were not sampled.
Main entry points: App.tsx React app · app.config.ts Express and Colyseus host · competitive.controller.ts Competitive runs · models Domain models
Components 23
Web client
- React app
client/src/App.tsx - Auth pages
client/src/pages/LoginPage.tsx - Room and lobby UI
client/src/pages/LobbyPage.tsx - Game mode pages
client/src/pages/BattlePage.tsx - Competitive pages
client/src/pages/CompetitiveSetupPage.tsx - Room hook
client/src/hooks/useRoom.ts - Battle hook
client/src/hooks/useBattle.ts - Colyseus client
client/src/colyseus/client.ts - Room state
client/src/store/room.store.ts
Realtime gameplay
- Express and Colyseus host
server/src/app.config.ts - Lobby room
server/src/rooms/MyRoom.ts - Game mode rooms
server/src/rooms
API and content
- REST routes
server/src/routes - Authentication
server/src/controllers/auth.controller.ts - Competitive runs
server/src/controllers/competitive.controller.ts - Quiz and RAG content
server/src/routes/rag.routes.ts - Content administration
server/src/controllers/admin.controller.ts
Data and integrations
- Domain models
server/src/models - MongoDB
- RAG service
- Codeforces API
- Piston execution
server/src/services/piston.ts
Other components
- Learner
Connections 25
- Learner → React app: uses
README.md - React app → Auth pages: routes to
client/src/App.tsx - React app → Room and lobby UI: routes to
client/src/App.tsx - React app → Game mode pages: routes to
client/src/App.tsx - React app → Competitive pages: routes to
client/src/App.tsx - Room hook → Colyseus client: creates rooms
client/src/hooks/useRoom.ts - Room hook → Room state: updates
client/src/hooks/useRoom.ts - Battle hook → Colyseus client: joins room
client/src/hooks/useBattle.ts - Room and lobby UI → Room hook: controls
- Game mode pages → Battle hook: uses
- Colyseus client → Express and Colyseus host: connects by WebSocket
README.md - Express and Colyseus host → REST routes: mounts
server/src/app.config.ts - Express and Colyseus host → Lobby room: registers
server/src/app.config.ts - Express and Colyseus host → Game mode rooms: registers
server/src/app.config.ts - REST routes → Authentication: dispatches
- REST routes → Competitive runs: dispatches
- Authentication → Domain models: reads and writes users
server/src/controllers/auth.controller.ts - Authentication → MongoDB: persists users
- Quiz and RAG content → RAG service: forwards uploads
server/src/routes/rag.routes.ts - Quiz and RAG content → Domain models: stores generated content
server/src/routes/rag.routes.ts - Content administration → Domain models: manages content
server/src/controllers/admin.controller.ts - Competitive runs → Domain models: tracks runs
server/src/controllers/competitive.controller.ts - Competitive runs → Codeforces API: fetches problems
server/src/controllers/competitive.controller.ts - Competitive runs → Piston execution: executes code
server/src/controllers/competitive.controller.ts - Game mode rooms → MongoDB: loads learning content