Full-stack workspace combining a Node/Express backend (with MongoDB + Socket.IO) and a Vite/React frontend for collaborative problem solving, code execution, and discussion features.
- Node.js 18+
- npm 9+ (comes with Node)
- MongoDB running locally or accessible via connection string
- Clone or download this repository.
- Install root dependencies (provides workspaces for both apps):
npm install - Install service-specific dependencies if needed:
cd backend && npm install cd ../frontend && npm install - Create environment files following the templates below.
MONGO_URI=mongodb://localhost:27017/chatapp
PORT=3002
secret_key=replace_this_with_strong_secret
FRONTEND_URL=http://localhost:3000
CLOUDINARY_CLOUD_NAME=...
CLOUDINARY_API_KEY=...
CLOUDINARY_API_SECRET=...
NODE_ENV=developmentFor Production (Render):
MONGO_URI: Your MongoDB Atlas connection string (e.g.,mongodb+srv://user:pass@cluster.mongodb.net/chatapp)FRONTEND_URL: Your Vercel frontend URL (e.g.,https://your-app.vercel.app)secret_key: Strong random secret for JWT signingNODE_ENV=production
Optional Vite-style env vars:
VITE_API_BASE=http://localhost:3002For Production (Vercel):
VITE_API_BASE: Your Render backend URL (e.g.,https://your-backend.onrender.com)
cd backend
npm run dev # uses nodemon; npm start for plain node
The server listens on http://localhost:3002 and expects MongoDB reachable via MONGO_URI.
cd frontend
npm run dev
The Vite dev server (default http://localhost:5173) proxies API requests to http://localhost:3002 per package.json.
- Connect your GitHub repository to Render
- Create a new Web Service
- Set build command:
cd backend && npm install - Set start command:
cd backend && npm start - Add environment variables:
MONGO_URI: Your MongoDB Atlas connection stringFRONTEND_URL: Your Vercel frontend URLsecret_key: Strong JWT secretNODE_ENV=production- Cloudinary credentials (if using)
- Render will auto-assign
PORT- no need to set it
- Connect your GitHub repository to Vercel
- Set root directory to
frontend - Build command:
npm run build - Output directory:
dist - Add environment variable:
VITE_API_BASE: Your Render backend URL
- Deploy
- Create a free cluster at MongoDB Atlas
- Create a database user
- Whitelist IP addresses (or use
0.0.0.0/0for Render) - Get connection string and use as
MONGO_URI
- Ensure MongoDB is seeded with problems/submissions as needed.
- CORS is configured to allow both localhost (dev) and your production frontend URL.
- Health check endpoint available at
/healthfor monitoring.