This guide will help you deploy your WebRTC Camera Stream application to production.
- GitHub account
- Vercel account (for frontend)
- Render account (for backend)
- Initialize Git repository:
cd webrtc
git init
git add .
git commit -m "Initial commit: WebRTC camera streaming app"- Create GitHub repository and push your code:
git remote add origin https://github.com/yourusername/webrtc-camera-stream.git
git branch -M main
git push -u origin main-
Go to Render Dashboard
-
Click "New +" → "Web Service"
-
Connect your GitHub repository
-
Configure the service:
- Name:
webrtc-signaling-server - Root Directory:
backend - Environment:
Node - Build Command:
npm install - Start Command:
npm start
- Name:
-
Add Environment Variables:
NODE_ENV=production FRONTEND_URL=https://your-vercel-app.vercel.app -
Deploy and copy the service URL (e.g.,
https://webrtc-signaling-server.onrender.com)
-
Go to Vercel Dashboard
-
Click "New Project"
-
Import your GitHub repository
-
Configure the project:
- Root Directory:
frontend - Framework Preset:
Next.js - Build Command:
npm run build - Output Directory:
.next
- Root Directory:
-
Add Environment Variables:
NEXT_PUBLIC_SIGNALING_SERVER_URL=https://your-render-app.onrender.com -
Deploy and copy the app URL (e.g.,
https://webrtc-camera-stream.vercel.app)
NODE_ENV=production
FRONTEND_URL=https://your-actual-vercel-url.vercel.app
NEXT_PUBLIC_SIGNALING_SERVER_URL=https://your-actual-render-url.onrender.com
- Visit your Vercel app URL
- Create a new session
- Test QR code scanning with your phone
- Verify video streaming works
CORS Errors
- Ensure
FRONTEND_URLin backend matches your Vercel URL exactly - Check that both apps are using HTTPS
Camera Access Issues
- HTTPS is required for camera access in production
- Both Vercel and Render provide HTTPS by default
Connection Failures
- Verify environment variables are set correctly
- Check browser developer tools for error messages
- Ensure both services are running
Render Free Tier Limitations
- Services may sleep after 15 minutes of inactivity
- First request after sleeping may take 30+ seconds
- Consider upgrading to paid tier for production use
- Home page loads
- Session creation works
- QR code generates
- Phone can access stream URL
- Camera permission request works
- Video stream displays on viewer
- Camera switching works (mobile)
- Disconnect/reconnect handling
Both Vercel and Render support automatic deployment:
- Vercel: Automatically deploys on push to main branch
- Render: Automatically deploys on push to main branch
Your app will be live at:
- Frontend:
https://your-app.vercel.app - Backend:
https://your-backend.onrender.com
After successful deployment, consider:
- Custom Domain: Configure custom domains in Vercel/Render
- Analytics: Add analytics to track usage
- Error Monitoring: Implement error tracking (Sentry, etc.)
- Performance: Monitor and optimize performance
- Scaling: Upgrade to paid tiers for better performance
If you encounter issues:
- Check the troubleshooting section
- Review browser developer tools
- Check Render/Vercel logs
- Ensure all environment variables are correct