How vaishnavi-a-das/collaborative-study-platform works
1. This repo is a split-client/server collaborative study platform: a React single-page app in frontend/ talks to an Express/Node backend in backend/, with MongoDB/Mongoose as the persistent system of record. Real-time collaboration is layered on top with Socket.IO, while audio/video sessions use WebRTC peer-to-peer connections.
2. The frontend is organized around three main pages: Home for landing, Auth for login/registration, and Dashboard for the live workspace. App.js is the top-level composition point, and services/socket.js is the client’s dedicated Socket.IO connection layer.
3. The collaborative workspace is decomposed into focused UI modules: ChatArea, Whiteboard, MembersList, and Sidebar, with modal components for creating rooms, joining rooms, inviting members, viewing invitations, and handling pending requests. This indicates the dashboard is the main shell that orchestrates room state and multiple collaboration tools side by side.
4. The backend exposes REST routes under routes/auth.js, routes/rooms.js, and routes/users.js. These are protected by middleware/auth.js, so JWT-based authentication gates access to room and user operations.
5. MongoDB data is modeled explicitly through Mongoose models: User, Room, Message, and Invitations. That suggests persistence is split by concern: identity/accounts, room membership and metadata, chat/message history, and invitation/request workflow.
6. The real-time data plane is Socket.IO. It is used for instant chat delivery, online/offline member presence, room membership updates, whiteboard synchronization, and WebRTC signaling. The frontend socket client and the backend Socket.IO server are the key boundary for live collaboration events.
7. WebRTC is used only for media transport, not for app state. The signaling flow goes through Socket.IO, then peers connect directly using STUN-backed peer negotiation. That means audio/video and screen-sharing traffic bypasses the app server after setup, reducing backend media load.
8. There is a backend service at services/gemini.js, which implies an AI/chatbot capability inside the study room experience. Architecturally, this is a supporting service invoked from the server side rather than a separate product boundary.
9. The deployment boundary is standard for a modern MERN app: frontend on Vercel, backend on Render, database on MongoDB Atlas. The frontend is configured to point to backend API and socket URLs via environment variables, so the UI can be deployed independently from the API.
10. If you are drawing the architecture, the most important relationships are: React UI ↔ REST API for authentication and persistent room/user data; React UI ↔ Socket.IO for live collaboration; Socket.IO ↔ backend for signaling and broadcast; backend ↔ MongoDB for persistence; and WebRTC ↔ browser peers for audio/video once signaling completes.
Main entry points: Dashboard.jsx Dashboard · server.js Server · App.js App · auth.js Auth Guard
Components 20
Frontend
React single-page app and workspace UI
- App · Top-level UI composition and routing
frontend/src/App.js - Home · Landing page
frontend/src/pages/Home.jsx - Auth · Login and registration screen
frontend/src/pages/Auth.jsx - Dashboard · Main collaborative room shell
frontend/src/pages/Dashboard.jsx - ChatArea · Room chat panel
frontend/src/components/ChatArea.jsx - Whiteboard · Shared drawing and annotation surface
frontend/src/components/Whiteboard.jsx - MembersList · Presence and room participant list
frontend/src/components/MembersList.jsx - Sidebar · Room navigation and actions
frontend/src/components/Sidebar.jsx - Room Modals · Create, join, invite, invitation, and request dialogs
- Socket Client · Browser Socket.IO connection layer
frontend/src/services/socket.js
Backend
Express API, persistence, and live collaboration server
- Server · HTTP API and realtime server entrypoint
backend/server.js - Auth Routes · Authentication endpoints
backend/routes/auth.js - Room Routes · Room lifecycle and collaboration endpoints
backend/routes/rooms.js - User Routes · User-related endpoints
backend/routes/users.js - Auth Guard · JWT protection for secured routes
backend/middleware/auth.js - Mongoose Models · User, Room, Message, and Invitation schemas
- Gemini Service · Server-side assistant or chat support integration
backend/services/gemini.js - MongoDB · Persistent system of record
Realtime & Media
Live collaboration and peer media transport
- Socket.IO · Live collaboration transport and signaling
- WebRTC · Direct browser-to-browser audio/video and screen sharing
Connections 24
- App → Home: renders · Top-level composition includes landing view
- App → Auth: routes · Top-level auth view
- App → Dashboard: routes · Top-level workspace view
- Dashboard → ChatArea: contains · Dashboard hosts chat
- Dashboard → Whiteboard: contains · Dashboard hosts whiteboard
- Dashboard → MembersList: contains · Dashboard shows members
- Dashboard → Sidebar: contains · Dashboard shell controls room actions
- Dashboard → Room Modals: opens · Workspace uses dialogs for room and invitation workflows
- Socket Client → Socket.IO: connects · Client realtime connection
- App → Socket Client: uses · Application-level socket access
- Server → Auth Routes: serves · Authentication API
- Server → Room Routes: serves · Room API
- Server → User Routes: serves · User API
- Auth Routes → Auth Guard: protects · JWT gating on secured auth flows
- Room Routes → Auth Guard: protects · Room operations require auth
- User Routes → Auth Guard: protects · User operations require auth
- Server → Socket.IO: hosts · Socket.IO server boundary
- Socket.IO → WebRTC: signals · Negotiates peer media connections
- Server → Mongoose Models: uses · API and realtime flows persist through models
- Mongoose Models → MongoDB: persists to · Mongoose-backed storage
- Server → Gemini Service: invokes · Server-side AI support service
- Dashboard → Socket.IO: receives · Chat, presence, and whiteboard updates
- Dashboard → WebRTC: establishes · Peer media sessions after signaling
- Dashboard → Server: api calls · Persistent auth and room operations