How foramgandhicodecraft/collaborative-code-editor works
CollabCode is a browser-based collaborative coding platform. Users create or join a room, edit per-language code together, share presence and chat, and can request AI help or run code; execution is queued for isolated worker execution. The graph also includes profile uploads and the separate admin surface. Relationships are grounded in the excerpts and README architecture; some route and UI internals were not sampled, so those links rely on documented capabilities rather than inferred implementation details.
Main entry points: Editor.jsx Collaborative editor · index.js Socket event dispatcher · rooms.js Room state · worker.js Execution worker
Components 34
Browser experience
- Room lobby
client/src/pages/Lobby.jsx - Collaborative editor
client/src/pages/Editor.jsx - Code editor view
client/src/components/CodeEditor.jsx - Editor toolbar
client/src/components/Toolbar.jsx - Output panel
client/src/components/OutputPanel.jsx - Chat panel
client/src/components/ChatPanel.jsx - Users sidebar
client/src/components/UsersSidebar.jsx - AI assistant panel
client/src/components/AiPanel.jsx
Room collaboration
- Client Yjs documents
client/src/hooks/useYjs.js - Socket connection hook
client/src/hooks/useSocket.js - Socket event dispatcher
server/socket/index.js - Room membership
server/socket/roomHandlers.js - Yjs synchronization
server/socket/yjsHandlers.js - Room chat
server/socket/chatHandlers.js - Cursor presence
server/socket/awarenessHandlers.js - Room state
server/state/rooms.js
Code execution
- Execution dispatch
server/socket/executionHandlers.js - Redis job queue
server/config/redis.js - Execution worker
worker/worker.js - Isolated containers
- Worker output endpoint
server/routes/output.js
Platform services
- HTTP server entry
server/index.js - HTTP route registry
server/routes/index.js - AI assistance endpoint
server/routes/ai.js - AI provider
- Profile upload endpoint
server/routes/upload.js - Cloudinary storage
Administration
- Admin dashboard
client/src/pages/Admin/AdminDashboard.jsx - Admin API client
client/src/services/adminApi.js - Admin routes
server/routes/admin.js - Admin authentication
server/routes/admin/auth.js - Admin session tokens
server/utils/adminSession.js - Admin route guard
client/src/guards/AdminRoute.jsx
Other components
- Room participant
Connections 36
- Room participant → Room lobby: joins room
README.md - Room lobby → Collaborative editor: opens session
client/src/App.jsx - Collaborative editor → Code editor view: renders
client/src/pages/Editor.jsx - Collaborative editor → Editor toolbar: renders
client/src/pages/Editor.jsx - Collaborative editor → Output panel: renders
client/src/pages/Editor.jsx - Collaborative editor → Chat panel: renders
client/src/pages/Editor.jsx - Collaborative editor → Users sidebar: renders
client/src/pages/Editor.jsx - Collaborative editor → AI assistant panel: renders
client/src/pages/Editor.jsx - Collaborative editor → Client Yjs documents: uses documents
client/src/pages/Editor.jsx - Collaborative editor → Socket event dispatcher: sends room events
README.md - Client Yjs documents → Socket event dispatcher: syncs updates
README.md - Socket event dispatcher → Room membership: registers handlers
server/socket/index.js - Socket event dispatcher → Yjs synchronization: registers handlers
server/socket/index.js - Socket event dispatcher → Room chat: registers handlers
server/socket/index.js - Socket event dispatcher → Cursor presence: registers handlers
server/socket/index.js - Room membership → Room state: reads and updates
server/socket/roomHandlers.js - Yjs synchronization → Room state: reads and updates
server/socket/yjsHandlers.js - Room chat → Room state: uses room state
server/socket/chatHandlers.js - Cursor presence → Room state: uses room state
server/socket/awarenessHandlers.js - Collaborative editor → Execution dispatch: requests execution
README.md - Execution dispatch → Redis job queue: queues job
README.md - Redis job queue → Execution worker: dispatches job
README.md - Execution worker → Isolated containers: runs code
README.md - Execution worker → Worker output endpoint: posts output
README.md - HTTP server entry → HTTP route registry: registers routes
server/index.js - HTTP server entry → Socket event dispatcher: starts sockets
server/index.js - HTTP route registry → AI assistance endpoint: mounts
server/routes/index.js - AI assistance endpoint → AI provider: requests inference
README.md - Collaborative editor → AI assistance endpoint: requests assistance
README.md - HTTP route registry → Profile upload endpoint: mounts
server/routes/index.js - Profile upload endpoint → Cloudinary storage: stores profile image
README.md - Admin dashboard → Admin API client: calls API
client/src/pages/Admin/AdminDashboard.jsx - Admin API client → Admin routes: sends requests
README.md - Admin routes → Admin authentication: routes authentication
server/routes/admin.js - Admin authentication → Admin session tokens: creates and verifies
server/routes/admin/auth.js - Admin route guard → Admin API client: checks access
client/src/guards/AdminRoute.jsx