A real-time collaborative coding platform for pair programming, technical interviews, and coding practice sessions.
- Frontend: pair-code-fe.vercel.app
- Backend: pair-code-be-t953.onrender.com
video1450339436.mp4
- Real-time Code Collaboration - Write code together with live synchronization using Yjs CRDT
- Monaco Editor - VS Code-like editing experience with syntax highlighting and IntelliSense
- Video Chat - Face-to-face communication powered by LiveKit
- AI-Powered Questions - Generate coding challenges using Google Gemini AI
- Solution Reviews - AI-assisted code review and feedback
- Infinite Rooms - Create unlimited collaborative sessions
- Dark/Light Mode - Theme switching for comfortable coding
- Framework: Next.js 16 (React 19)
- Editor: Monaco Editor (@monaco-editor/react)
- Real-time Sync: Yjs + y-websocket + y-monaco
- Video: LiveKit (@livekit/components-react)
- Styling: Tailwind CSS 4
- UI Components: Radix UI, shadcn/ui
- Runtime: Node.js with Express 5
- WebSocket: ws library with @y/websocket-server
- Database: MongoDB with Mongoose
- Auth: JWT (jsonwebtoken + bcryptjs)
- AI: OpenAI (@openai/openai)
- Video: LiveKit Server SDK
p2p-program/
βββ frontend/ # Next.js frontend application
β βββ app/ # App router pages
β βββ components/ # React components
β βββ lib/ # Utilities and API functions
β βββ hooks/ # Custom React hooks
β
βββ backend/ # Node.js backend server
β βββ src/
β β βββ http/ # Express routes
β β βββ ws/ # WebSocket handlers
β β βββ config/ # Configuration files
β β βββ utils/ # Helper functions
β β βββ types/ # TypeScript types
β βββ dist/ # Compiled JavaScript
β
βββ README.md
- Node.js 18+
- MongoDB instance
- LiveKit account (for video chat)
- OpenAI API key (for AI features)
cd backend
# Install dependencies
npm install
# Create .env file with required variables
cp .env.example .env
# Build TypeScript
npm run build
# Start development server
npm run devEnvironment Variables (backend/.env):
PORT=8000
MONGO_URI=mongodb://localhost:27017/codetogether
JWT_SECRET=your-jwt-secret
OPENAI_API_KEY=your-openai-key
LIVEKIT_API_KEY=your-livekit-key
LIVEKIT_API_SECRET=your-livekit-secretcd frontend
# Install dependencies
npm install
# Start development server
npm run devEnvironment Variables (frontend/.env.local):
NEXT_PUBLIC_ENVIRONMENT=DEVELOPMENT- Create a new Web Service on Render
- Connect your GitHub repository
- Set build command:
npm install && npm run build - Set start command:
npm run start - Add environment variables
- Import project from GitHub
- Set root directory to
frontend - Add environment variable:
NEXT_PUBLIC_ENVIRONMENT=PRODUCTION - Deploy
The application uses a single WebSocket endpoint (/ws) with query parameter routing:
- Room connections:
/ws?room=<roomId>&type=room - Yjs sync connections:
/ws?room=<roomId>&type=yjs
Features:
noServermode for manual upgrade handling- Ping/pong keepalive (30s interval) for proxy compatibility
- Compatible with Render, Vercel, and other reverse proxies
| Endpoint | Method | Description |
|---|---|---|
/auth/signup |
POST | User registration |
/auth/signin |
POST | User login |
/api/chat/question |
GET | Generate AI coding question |
/api/chat/answer |
POST | Submit solution for AI review |
/livekit/getToken |
GET | Get LiveKit room token |
/code/run |
POST | Execute code |
/code/submit |
POST | Submit code solution |
Trishit Bhowmik
- GitHub: @trishit78
- LinkedIn: trishit-bhowmik
- Email: trishit456@gmail.com
This project is licensed under the ISC License.