CodeLab is a full-stack, browser-based collaborative coding platform where users can create coding rooms, write code together in real time, chat with teammates, and work inside a shared workspace โ all without refreshing the page.
- ๐ Authentication โ registration and login with JWT-based auth and protected routes
- ๐ Dashboard โ create rooms and view My Rooms
- ๐งโ๐ป Coding rooms โ each room is a shared workspace at
/room/:roomId - ๐ Monaco Editor โ the same editor technology that powers VS Code, running in the browser
- โก Real-time code sync โ edits made by one user appear instantly in other browsers in the same room, no refresh needed
- ๐ฌ Room chat โ real-time messaging with correct per-user attribution
- ๐ฅ Multi-user tested โ verified with multiple browser sessions and separate accounts
โถ๏ธ Code execution โ run code from the browser and view the output or errors- ๐ณ Isolated execution with Docker โ user code runs in a container instead of inside the main Node.js process, keeping the backend safer
- ๐ Environment-based config โ secrets and URLs kept out of source code
| Layer | Technologies |
|---|---|
| Frontend | React.js, JavaScript (JSX), React Router, Monaco Editor, Socket.IO Client, HTML, CSS, Vite |
| Backend | Node.js, Express.js, REST APIs, Socket.IO, JWT |
| Database | PostgreSQL 18 |
| Infrastructure / Tools | Docker, Docker Desktop, WSL 2, Git, GitHub, VS Code, Thunder Client |
The frontend is written in JavaScript/JSX, not TypeScript.
React Frontend
โ
REST API / Socket.IO
โ
Node.js + Express Backend
โ
PostgreSQL
CodeLab uses two communication channels, each for what it does best:
- REST APIs โ registration, login, creating/retrieving rooms, persistent data
- Socket.IO โ real-time code synchronization, chat, and room events
The React frontend never talks to the database directly; all data access goes through the Express backend.
User A edits code in Monaco
โ
Socket.IO client emits "code-change" (roomCode, fileId, code)
โ
Socket.IO server receives the event
โ
Server broadcasts to other sockets in the same room
โ
User B's Monaco Editor updates instantly
Socket.IO rooms ensure users only receive events from the coding room they have joined.
User clicks "Run Code"
โ
Backend
โ
Docker container (isolated environment)
โ
Program output / errors
โ
Frontend
| Route | Description |
|---|---|
/ |
Home page |
/login |
User login |
/register |
User registration |
/dashboard |
Create rooms and view My Rooms |
/room/:roomId |
Collaborative coding room (editor + chat + sync) |
- User registers or logs in from the React frontend.
- The Express API validates credentials against PostgreSQL.
- On success, the server issues a JWT (expires in about 1 hour).
- The frontend sends the token with protected requests:
Authorization: Bearer <JWT>
- Authentication middleware on the backend verifies the token before allowing access.
The JWT secret is loaded from environment variables and is never hardcoded.
codelab/
โโโ frontend/ # React + Vite app (Monaco Editor, Socket.IO client)
โโโ backend/ # Express API + Socket.IO server (server.js)
- Node.js
- PostgreSQL 18
- Git
- (Optional, for code execution work) Docker Desktop with WSL 2
git clone https://github.com/srinilaya08/CodeLab.git
cd codelabcd backend
npm installCreate a .env file in backend/:
PORT=5000
DB_HOST=localhost
DB_PORT=5432
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=codelab
JWT_SECRET=your_strong_secret
FRONTEND_URL=http://localhost:5173Start the server:
node server.jsThe backend runs at http://localhost:5000.
cd frontend
npm installCreate a .env file in frontend/:
VITE_API_URL=http://localhost:5000
VITE_SOCKET_URL=http://localhost:5000Start the dev server:
npm run dev- Register two accounts.
- Log in as User A in one browser and User B in another (or use an incognito window).
- Create a room from the dashboard and open the same room in both sessions.
- Edit code and send chat messages โ changes appear in real time.
401 Unauthorizedon protected routes โ fixed the JWT flow between frontend and backend middleware.- My Rooms retrieval โ corrected authenticated room fetching.
- Real-time sync โ implemented Monaco โ Socket.IO synchronization across browsers.
- Chat attribution โ fixed messages being tied to the wrong account across two sessions.
- Docker setup โ configured Docker Desktop and WSL 2 and verified with
hello-worldand a Node.js container.
- Support for more programming languages
- Additional workspace capabilities (e.g., multi-file support)
- Execution hardening (time and resource limits)
- Production hardening and deployment
CodeLab is a full-stack collaborative coding platform built with React, Node.js, Express, PostgreSQL, Socket.IO, JWT authentication, and Monaco Editor, with Docker used for the isolated code-execution architecture. Its standout capability is real-time collaborative coding: multiple users enter the same room, edit code together, and chat, with changes synced instantly and no page refresh.
Srinilaya
This project is licensed under the MIT License. See the LICENSE file for details.



