How sanket9162/codershouse works
CodersHouse is a browser-based real-time audio-room platform. Users authenticate by phone OTP, receive JWT cookies, activate a profile, browse or create rooms, and join a room as speakers or listeners. The frontend’s room experience uses WebRTC for peer audio and Socket.IO for signalling; the backend exposes HTTP routes, validates protected requests, and persists users and rooms in MongoDB. The sampled sources substantiate the HTTP and WebRTC client flows; Socket.IO server internals and several frontend page implementations were not sampled, so their detailed wiring is shown only where documented.
Main entry points: handler.go API handlers · index.jsx HTTP client · useLoadingWithRefresh.jsx Session refresh · useWebRTC.jsx WebRTC hook
Components 24
Web Client
- App routes
frontend/src/App.jsx - HTTP client
frontend/src/http/index.jsx
Identity
- Authentication UI
frontend/src/pages/Authenticate/Authenticate.jsx - Profile activation
frontend/src/pages/Activate/Activate.jsx - Session refresh
frontend/src/hooks/useLoadingWithRefresh.jsx - Auth state
frontend/src/store/authSlice.jsx - Token services
backend/internal/config/config.go - OTP encryption
backend/internal/utils/encryption.go - Avatar storage
backend/internal/utils/image.go
Room Platform
- Room browser
frontend/src/pages/Rooms/Rooms.jsx - Room view
frontend/src/pages/Room/Room.jsx - WebRTC hook
frontend/src/hooks/useWebRTC.jsx - Socket client
frontend/src/socket/index.jsx - Signalling server
backend/internal/socket/socket.go
Backend Services
- HTTP routes
backend/cmd/api/routes.go - JWT middleware
backend/internal/middleware/auth.go - API handlers
backend/internal/handler/handler.go
Persistence
- Repository interface
backend/internal/repository/repository.go - Mongo repository
backend/internal/repository/dbrepo/mongo.go - MongoDB
backend/internal/database/db.go
Other components
- User
- Peer browser
- WebRTC media
- SMS provider
Connections 23
- User → App routes: uses
- App routes → Session refresh: checks session
- Session refresh → HTTP client: requests refresh
- Session refresh → Auth state: sets auth
- Authentication UI → HTTP client: submits OTP
- Profile activation → HTTP client: activates profile
- Room browser → HTTP client: loads rooms
- Room view → WebRTC hook: starts audio
- WebRTC hook → Socket client: signals peers
- WebRTC hook → WebRTC media: captures audio
- Socket client → Signalling server: exchanges events
- HTTP client → HTTP routes: sends requests
- HTTP routes → API handlers: dispatches
- HTTP routes → JWT middleware: protects routes
- JWT middleware → API handlers: passes identity
- API handlers → OTP encryption: hashes OTP
- API handlers → Token services: issues tokens
- API handlers → Avatar storage: saves avatar
- API handlers → Repository interface: reads and writes
- Repository interface → Mongo repository: implemented by
- Mongo repository → MongoDB: persists records
- Peer browser → WebRTC media: exchanges audio
- SMS provider → API handlers: optional OTP delivery