Nestr Production Deployment Guide
Complete guide for deploying Nestr to production using Railway (backend) and Vercel (frontend).Quick Start
Table of Contents
- Prerequisites
- Backend Deployment (Railway)
- Frontend Deployment (Vercel)
- Production Configuration
- Smoke Testing
- Post-Deployment
- Troubleshooting
- Rollback Procedures
Prerequisites
Required Tools
Accounts Required
- Railway Account: Sign up at railway.app
- Vercel Account: Sign up at vercel.com
Authentication
Backend Deployment (Railway)
Step 1: Prepare Backend
Step 2: Deploy to Railway
Option A: Using Deployment Script (Recommended)
- ✅ Check Railway CLI installation
- ✅ Verify authentication
- ✅ Link or create Railway project
- ✅ Set environment variables
- ✅ Run pre-deployment checks
- ✅ Deploy using Dockerfile
- ✅ Verify deployment health
Option B: Manual Deployment
Step 3: Get Backend URL
Step 4: Verify Backend Deployment
Frontend Deployment (Vercel)
Step 1: Prepare Frontend
Step 2: Deploy to Vercel
Option A: Using Deployment Script (Recommended)
- ✅ Check Vercel CLI installation
- ✅ Verify authentication
- ✅ Link or create Vercel project
- ✅ Set VITE_API_URL environment variable
- ✅ Verify backend connectivity
- ✅ Build and deploy
- ✅ Test deployment
Option B: Manual Deployment
Step 3: Get Frontend URL
After deployment, Vercel will output your deployment URL:Step 4: Update Backend CORS
Critical: Update Railway backend to allow requests from frontend:Production Configuration
Backend Environment Variables (Railway)
Required
| Variable | Value | Description |
|---|---|---|
ENVIRONMENT | production | Environment name |
PORT | 8080 | Server port (Railway provides PORT automatically) |
LOG_LEVEL | info | Logging level |
CORS_ALLOWED_ORIGINS | https://your-frontend.vercel.app | Allowed origins for CORS |
Recommended
| Variable | Value | Description |
|---|---|---|
DB_PATH | /app/data/nestr.db | SQLite database path |
ENABLE_METRICS | true | Enable Prometheus metrics |
ENABLE_TRACING | false | Distributed tracing (optional) |
RATE_LIMIT_ENABLED | true | Enable rate limiting |
RATE_LIMIT_REQUESTS_PER_MINUTE | 100 | Rate limit threshold |
Optional
| Variable | Value | Description |
|---|---|---|
MAX_REQUEST_SIZE_MB | 10 | Max request body size |
REQUEST_TIMEOUT_SECONDS | 30 | Request timeout |
WORKSPACE_ROOT | /app/workspace | Workspace directory |
Setting Variables in Railway
Frontend Environment Variables (Vercel)
Required
| Variable | Value | Description |
|---|---|---|
VITE_API_URL | https://your-backend.up.railway.app | Backend API base URL |
Setting Variables in Vercel
Smoke Testing
Automated Smoke Tests
Run comprehensive smoke tests against production:- ✅ Backend health endpoints
- ✅ API endpoints (workspace, services)
- ✅ CORS configuration
- ✅ Frontend deployment
- ✅ Security headers
- ✅ Response times
- ✅ Integration connectivity
Manual Testing Checklist
Backend
- Health check:
curl https://backend/health - Readiness:
curl https://backend/ready - Metrics:
curl https://backend/metrics - Workspace API:
curl https://backend/api/workspace - Services API:
curl https://backend/api/services
Frontend
- Homepage loads: Visit
https://frontend - No console errors (check browser DevTools)
- API calls succeed (check Network tab)
- Data displays correctly
- Responsive on mobile
Integration
- Frontend can fetch data from backend
- CORS headers present
- No authentication/permission errors
Post-Deployment
Monitoring
Railway Monitoring
Vercel Monitoring
Custom Domains (Optional)
Railway Custom Domain
Vercel Custom Domain
Metrics and Analytics
Backend Metrics
Access Prometheus metrics:http_requests_total- Total requestshttp_request_duration_seconds- Request latencyhttp_requests_in_flight- Active requests
Frontend Analytics
Consider adding:- Vercel Analytics (built-in)
- Google Analytics
- Sentry for error tracking
- LogRocket for session replay
Security
SSL/TLS
- ✅ Railway provides automatic SSL
- ✅ Vercel provides automatic SSL
- ✅ All connections encrypted (HTTPS)
Secrets Management
- ✅ Environment variables encrypted at rest
- ✅ Never commit
.envfiles - ✅ Rotate secrets periodically
Security Headers
Vercel automatically adds (viavercel.json):
X-Content-Type-Options: nosniffX-Frame-Options: DENYX-XSS-Protection: 1; mode=block
Backups
Database Backup
Configuration Backup
Troubleshooting
Backend Issues
”Service Not Starting"
"Health Check Failing"
"Database Errors”
Frontend Issues
”Failed to Fetch” Errors
”Blank Page"
"CORS Errors”
Integration Issues
”API Calls Failing”
- Check browser console for specific errors
- Verify environment variable:
VITE_API_URLin Vercel - Test backend directly:
curl https://backend/api/workspace - Check CORS: Origin must match frontend URL exactly
- Verify network tab: Look for 4xx/5xx responses
”Slow Performance”
Rollback Procedures
Railway Rollback
Vercel Rollback
Emergency Rollback
If both services have issues:-
Immediately rollback frontend (fastest)
-
Then rollback backend
-
Verify rollback
- Investigate issues in logs before redeploying
Production Checklist
Pre-Deployment
- All tests passing locally
- E2E tests passing:
yarn test:e2e - Backend builds successfully:
go build - Frontend builds successfully:
yarn build - Environment variables documented
- Secrets rotated (if applicable)
- Database migrations tested
- CORS origins configured
- Monitoring set up
Deployment
- Backend deployed to Railway
- Backend health check passing
- Frontend deployed to Vercel
- Frontend loads correctly
- CORS updated for frontend URL
- Smoke tests passing
- Integration verified
Post-Deployment
- Monitor logs for errors
- Check metrics for anomalies
- Verify user-facing functionality
- Update documentation
- Notify team of deployment
- Create backup of current state
Architecture Overview
- User visits
https://nestr.vercel.app - Vercel serves static React app
- React app makes API calls to
https://nestr-engine.up.railway.app - Railway backend processes requests
- CORS headers allow cross-origin requests
- Responses returned to frontend
- Frontend renders data
Support and Resources
Documentation
Deployment Scripts
- Railway Deployment:
engine/scripts/deploy-railway.sh - Vercel Deployment:
web/scripts/deploy-vercel.sh - Smoke Tests:
scripts/smoke-test-production.sh
Monitoring Commands
Getting Help
- Review logs first:
railway logsandvercel logs - Check smoke test output
- Review this troubleshooting section
- Check platform status pages:
Summary
✅ Backend: Deployed to Railway with Dockerfile ✅ Frontend: Deployed to Vercel with Vite ✅ CORS: Configured for cross-origin requests ✅ SSL: Automatic HTTPS on both platforms ✅ Monitoring: Logs and metrics available ✅ Testing: Automated smoke tests included Production URLs:- Backend:
https://<your-project>.up.railway.app - Frontend:
https://<your-project>.vercel.app
- Run smoke tests regularly
- Set up monitoring alerts
- Configure custom domains (optional)
- Plan scaling strategy
- Document runbooks for common operations