Everything runs on 2 services:
- Backend (Render) — Express API + Socket.IO + Yjs WebSocket — all on one port
- Frontend (Vercel) — Static React build
cd collabcode
# Initialize git (if not already)
git init
git add .
git commit -m "CollabCode - ready for deployment"
# Create repo on GitHub, then:
git remote add origin https://github.com/YOUR_USERNAME/collabcode.git
git branch -M main
git push -u origin main- Go to render.com → Sign up / Log in
- Click "New +" → "Web Service"
- Connect your GitHub repo (
collabcode) - Configure:
| Setting | Value |
|---|---|
| Name | collabcode-server |
| Root Directory | server |
| Runtime | Node |
| Build Command | npm install |
| Start Command | node index.js |
- Add Environment Variables:
| Key | Value |
|---|---|
NODE_ENV |
production |
JWT_SECRET |
(any random long string) |
GEMINI_API_KEY |
your_gemini_api_key_here |
FRONTEND_URL |
(add after Vercel deploy) |
- Click "Create Web Service"
- Wait for deploy → Note your URL (e.g.,
https://collabcode-server.onrender.com)
⚠️ Important: Render free tier sleeps after 15min of inactivity. First request after sleep takes ~30s.
- Go to vercel.com → Sign up / Log in
- Click "Import Project" → Select your GitHub repo
- Configure:
| Setting | Value |
|---|---|
| Root Directory | client |
| Framework | Vite |
| Build Command | npm run build |
| Output Directory | dist |
- Add Environment Variable:
| Key | Value |
|---|---|
VITE_BACKEND_URL |
https://collabcode-server.onrender.com |
⚠️ Replace with YOUR actual Render URL from Step 2!
- Click "Deploy"
- Note your frontend URL (e.g.,
https://collabcode.vercel.app)
Go back to Render → Your service → Environment → Add:
| Key | Value |
|---|---|
FRONTEND_URL |
https://collabcode.vercel.app |
Click "Save Changes" → Service will auto-redeploy.
Create vercel.json in the client/ folder:
{
"rewrites": [
{ "source": "/(.*)", "destination": "/" }
]
}This ensures routes like /editor/:roomId work on refresh.
- Open your Vercel URL →
https://collabcode.vercel.app - Enter username → Click "Create New Room"
- Click "Copy Invite Link"
- Send link to friend → They join the same room
- Collaborate in real-time! 🎉
# Terminal 1 — Backend (port 3001)
cd server && npm run dev
# Terminal 2 — Frontend (port 5173)
cd client && npm run dev| Service | Port | Protocol |
|---|---|---|
| REST API | 3001 | HTTP |
| Socket.IO | 3001 | WebSocket |
| Yjs Sync | 3001/yjs/ | WebSocket |
| Frontend | 5173 | HTTP |