How alanpraful-a/codecollab works
CodeCollab is a browser-based collaborative coding platform. Users register or log in, create or join a room, and edit JavaScript together; the editor also supports in-browser code execution, as documented in the README. Authentication uses REST endpoints backed by user records, while room edits and cursor awareness synchronize through Socket.io and Yjs, with Yjs state persisted to MongoDB. The sampled source shows the server and persistence calls; the README documents frontend-to-backend Socket.io communication. The editor’s internal execution implementation was not separately traced.
Main entry points: App.jsx App routing · Editor.jsx Editor and runner · server.js HTTP and socket server · AuthContext.jsx Session and API
Components 15
Browser experience
- App routing
frontend/src/App.jsx - Room lobby
frontend/src/pages/Home.jsx - Editor and runner
frontend/src/Editor.jsx - Login page
frontend/src/pages/Login.jsx - Registration page
frontend/src/pages/Register.jsx
Authentication
- Session and API
frontend/src/context/AuthContext.jsx - Auth endpoints
backend/routes/authRoutes.js - User records
backend/models/User.js
Room collaboration
- Room event handler
backend/sockets/editorSocket.js - Yjs synchronization
backend/services/yjsService.js - Room state records
backend/models/Room.js
Backend and persistence
- HTTP and socket server
backend/server.js - Database connection
backend/config/db.js
Other components
- Collaborator
- MongoDB
Connections 18
- Collaborator → App routing: uses
frontend/src/App.jsx - App routing → Room lobby: routes to
frontend/src/App.jsx - App routing → Editor and runner: routes to
frontend/src/App.jsx - App routing → Login page: routes to
frontend/src/App.jsx - App routing → Registration page: routes to
frontend/src/App.jsx - Room lobby → Editor and runner: navigates to
frontend/src/pages/Home.jsx - Login page → Session and API: calls login
frontend/src/pages/Login.jsx - Registration page → Session and API: calls register
frontend/src/pages/Register.jsx - Session and API → Auth endpoints: sends REST requests
frontend/src/context/AuthContext.jsx - Auth endpoints → User records: reads and writes
backend/routes/authRoutes.js - HTTP and socket server → Auth endpoints: mounts routes
backend/server.js - HTTP and socket server → Database connection: connects database
backend/server.js - Database connection → MongoDB: connects to
backend/config/db.js - HTTP and socket server → Room event handler: sets up
backend/server.js - Collaborator → Editor and runner: edits code
README.md - Editor and runner → Room event handler: synchronizes via Socket.io
README.md - Room event handler → Yjs synchronization: applies updates
backend/sockets/editorSocket.js - Yjs synchronization → Room state records: loads and saves state
backend/services/yjsService.js