Skip to main content

Nestr Deployment Quick Reference

Fast reference for common deployment tasks.

One-Command Deployment

# From project root
cd engine && ./scripts/deploy-railway.sh && cd ../web && ./scripts/deploy-vercel.sh && cd .. && ./scripts/smoke-test-production.sh

Railway (Backend)

Deploy

cd engine
./scripts/deploy-railway.sh
# or
railway up

Essential Commands

railway login                    # Authenticate
railway link                     # Link to project
railway up                       # Deploy
railway logs                     # View logs
railway logs --follow            # Tail logs
railway status                   # Check status
railway domain                   # Get/generate domain
railway open                     # Open dashboard

Set Environment Variable

railway variables set KEY=value
railway variables get KEY
railway variables

Critical Variables

railway variables set ENVIRONMENT=production
railway variables set PORT=8080
railway variables set LOG_LEVEL=info
railway variables set CORS_ALLOWED_ORIGINS="https://your-frontend.vercel.app"

Vercel (Frontend)

Deploy

cd web
./scripts/deploy-vercel.sh
# or
vercel --prod          # Production
vercel                 # Preview

Essential Commands

vercel login                     # Authenticate
vercel link                      # Link to project
vercel --prod                    # Deploy to production
vercel                           # Deploy to preview
vercel logs                      # View logs
vercel ls                        # List deployments
vercel inspect <url>             # Inspect deployment
vercel promote <url>             # Promote to production
vercel open                      # Open dashboard

Set Environment Variable

vercel env add KEY production
# Paste value when prompted

vercel env ls                    # List variables
vercel env rm KEY production     # Remove variable

Critical Variable

vercel env add VITE_API_URL production
# Enter: https://your-backend.up.railway.app

Testing

Local E2E Tests

cd web
yarn test:e2e                    # All tests
yarn test:e2e:ui                 # UI mode
yarn test:health                 # Health tests only
yarn test:report                 # View report

Production Smoke Tests

./scripts/smoke-test-production.sh \
  https://backend.up.railway.app \
  https://frontend.vercel.app

Quick Health Check

# Backend
curl https://your-backend.up.railway.app/health

# Frontend
curl https://your-frontend.vercel.app

# API
curl https://your-backend.up.railway.app/api/workspace

Monitoring

View Logs

# Railway logs
railway logs --follow

# Vercel logs
vercel logs --follow

Check Status

# Railway
railway status

# Vercel
vercel ls

Health Endpoints

# Health check
curl https://backend/health

# Readiness
curl https://backend/ready

# Metrics
curl https://backend/metrics

Troubleshooting

CORS Issues

# Update Railway CORS
cd engine
railway variables set CORS_ALLOWED_ORIGINS="https://your-frontend.vercel.app"
railway up

# Test CORS
curl -I -H "Origin: https://your-frontend.vercel.app" \
  https://your-backend.up.railway.app/api/workspace

Failed Deployment

# Railway: check logs
railway logs

# Vercel: inspect deployment
vercel inspect <deployment-url>

Rollback

# Vercel rollback (fastest)
vercel ls
vercel promote <previous-deployment-url>

# Railway rollback
# Use dashboard: Deployments → Previous → Redeploy
railway open

Common Tasks

Update Backend Code

cd engine
git pull
railway up
railway logs --follow

Update Frontend Code

cd web
git pull
vercel --prod

Change API URL

# 1. Get new backend URL
cd engine
railway domain

# 2. Update frontend
cd ../web
vercel env rm VITE_API_URL production
vercel env add VITE_API_URL production
# Enter new URL

# 3. Redeploy frontend
vercel --prod

Add Custom Domain

# Railway
railway domain add api.yourdomain.com
# Add CNAME: api.yourdomain.com → your-app.up.railway.app

# Vercel
vercel domains add yourdomain.com
# Follow DNS instructions

Emergency Procedures

Service Down

  1. Check status pages
  2. View logs
    railway logs
    vercel logs
    
  3. Rollback if needed
    vercel promote <last-good-deployment>
    

High Error Rate

  1. Check logs immediately
    railway logs --follow | grep -i error
    
  2. Run smoke tests
    ./scripts/smoke-test-production.sh
    
  3. Verify environment variables
    railway variables
    vercel env ls
    

CORS Errors After Deployment

# Quick fix
railway variables set CORS_ALLOWED_ORIGINS="https://your-frontend.vercel.app"
railway up

# Verify
curl -I -H "Origin: https://your-frontend.vercel.app" \
  https://your-backend.up.railway.app/health | grep -i access-control

URLs Format

Backend (Railway):
  https://<project-name>.up.railway.app
  https://<project-name>-production.up.railway.app

Frontend (Vercel):
  https://<project-name>.vercel.app
  https://<project-name>-<team>.vercel.app
  https://<git-branch>-<project>.vercel.app (preview)

Custom domains:
  https://api.yourdomain.com (backend)
  https://yourdomain.com (frontend)

Complete Guides

For detailed information, see:

Useful Aliases

Add to your ~/.bashrc or ~/.zshrc:
# Nestr deployment aliases
alias nestr-deploy-backend='cd ~/nestr/engine && ./scripts/deploy-railway.sh'
alias nestr-deploy-frontend='cd ~/nestr/web && ./scripts/deploy-vercel.sh'
alias nestr-deploy-all='nestr-deploy-backend && nestr-deploy-frontend'
alias nestr-smoke='cd ~/nestr && ./scripts/smoke-test-production.sh'
alias nestr-logs-backend='cd ~/nestr/engine && railway logs --follow'
alias nestr-logs-frontend='cd ~/nestr/web && vercel logs --follow'

Last Updated: 2025-12-23