Prerequisites
Before deploying, ensure you have:Production environment variables
- OpenAI API key with production access
- Twilio account with verified phone number
- Supabase project configured
- Domain name (optional but recommended)
SSL certificates
- WebSocket connections require HTTPS/WSS
- Use a service like Let’s Encrypt for free SSL
- Or use a platform that provides SSL automatically
Backend Deployment
The Highway backend can be deployed to various platforms:Option 1: Railway
Railway provides easy deployment with automatic SSL and environment variable management.Option 2: Render
Render offers free tier for backend services.Create new Web Service
- Go to Render Dashboard
- Click “New +” → “Web Service”
- Connect your GitHub repository
- Select
highway-backenddirectory
Add environment variables
In the Render dashboard, add all backend environment variables:
OPENAI_API_KEYPORT(Render provides this automatically)TWILIO_ACCOUNT_SIDTWILIO_AUTH_TOKENTWILIO_PHONE_NUMBER
Option 3: DigitalOcean App Platform
Create new app
- Go to DigitalOcean Apps
- Click “Create App”
- Connect your GitHub repository
- Select the
highway-backenddirectory
Backend Deployment Considerations
Platform Requirements:- Node.js 18+ runtime
- WebSocket support (not all platforms support this)
- Ability to listen on custom ports
- HTTPS/WSS for production
- ✅ Railway (excellent WebSocket support)
- ✅ Render (supports WebSockets)
- ✅ DigitalOcean App Platform
- ✅ AWS EC2 / Elastic Beanstalk
- ✅ Google Cloud Run
- ⚠️ Vercel (limited WebSocket support)
- ⚠️ Netlify (no WebSocket support for functions)
Frontend Deployment
The Highway frontend (Next.js) can be deployed to platforms optimized for React apps:Option 1: Vercel (Recommended)
Vercel is created by the Next.js team and offers the best integration.Add environment variables
In the Vercel dashboard:
- Go to Project Settings → Environment Variables
- Add
NEXT_PUBLIC_SUPABASE_URL - Add
NEXT_PUBLIC_SUPABASE_ANON_KEY - Add
NEXT_PUBLIC_BACKEND_URL(your deployed backend URL)
Option 2: Netlify
Option 3: Self-Hosted
Deploy to your own server:Environment Variable Management
Production Environment Variables
Backend (.env):Secrets Management Best Practices
Use platform secret management
- Most platforms encrypt environment variables
- Use platform UI to set sensitive values
- Never commit production secrets to Git
Separate environments
- Development:
.env.development - Staging:
.env.staging - Production:
.env.production
Database Setup (Supabase)
Your Supabase database should already be configured from the Environment Variables guide.Production Database Configuration
Enable connection pooling
In Supabase Dashboard → Database Settings:
- Enable connection pooling
- Set max connections based on your plan
Set up backups
- Enable automatic daily backups in Supabase
- Configure Point-in-Time Recovery (PITR) if available
- Test restore process periodically
Domain and SSL Setup
Custom Domain Configuration
Backend domain
- Add A record pointing to your backend server IP
- Or add CNAME to your platform’s domain
- Example:
api.your-domain.com
Frontend domain
- Add A record or CNAME for frontend
- Example:
app.your-domain.comorwww.your-domain.com
SSL Certificate Setup
Most platforms (Vercel, Railway, Render) provide automatic SSL. For self-hosted deployments:CORS Configuration for Production
Update backend CORS settings to only allow your frontend domain:index.js
Health Checks and Monitoring
Backend Health Check
The backend provides a health check endpoint:Monitoring Setup
Set up uptime monitoring
Configure logging
- Backend: Winston logs to console (captured by platform)
- Frontend: Next.js logs
- Consider external logging: Datadog, LogRocket, Sentry
Deployment Checklist
Before going live:- Backend deployed with all environment variables
- Frontend deployed with Supabase configuration
- Database migrations applied
- RLS policies configured
- Custom domains configured
- SSL certificates active
- CORS configured for production domain
- Health checks responding
- Twilio webhook URLs updated
- OpenAI API limits reviewed
- Monitoring and alerts configured
- Backup strategy in place
- Documentation updated with production URLs
Post-Deployment
Test full call flow
- Trigger a call from the frontend
- Verify Twilio connects successfully
- Test OpenAI conversation
- Confirm call logs appear in database
Monitor initial traffic
- Watch server logs for errors
- Monitor API rate limits
- Check database connection pool
- Review error rates
Troubleshooting
Build failures?- Check Node.js version matches locally
- Verify all dependencies in package.json
- Review build logs for specific errors
- Ensure platform supports WebSockets
- Verify SSL certificates are valid
- Check CORS configuration
- Test with WSS protocol (not WS)
- Redeploy after adding new variables
- Check variable names match exactly
- Verify frontend variables have
NEXT_PUBLIC_prefix
- Verify Supabase URL and key
- Check RLS policies aren’t blocking access
- Review connection pool settings
- Test database connection in Supabase dashboard
Next Steps
API Reference
Explore Highway API endpoints
Voice Configuration
Customize voice assistant behavior