#!/bin/bash # Redirect Intelligence v2 - Start Script # Kills existing processes and starts API + Frontend cleanly echo "🚀 Starting Redirect Intelligence v2..." # Kill existing processes echo "🔄 Stopping existing processes..." pkill -f "node.*dist/index" 2>/dev/null || true pkill -f "serve.*dist" 2>/dev/null || true sleep 2 # Start API Server echo "🌐 Starting API Server on port 3334..." cd /root/catch_redirect/apps/api DATABASE_URL="postgresql://postgres:postgres@localhost:5432/redirect_intelligence" \ REDIS_URL="redis://localhost:6379" \ JWT_SECRET="J9k2L7mP4nQ8vX3w6Z9c2F5h8K1m4P7r0T3w6Y9b2E5g8J1l4O7q0S3v6Z9c2F5h" \ NODE_ENV="production" \ PORT="3334" \ CORS_ORIGIN="https://urltrackertool.com" \ WEB_URL="https://urltrackertool.com" \ nohup node dist/index.js > api.log 2>&1 & # Wait for API to start sleep 3 # Start Frontend Server echo "🎨 Starting Frontend Server on port 3000..." cd /root/catch_redirect/apps/web nohup npx serve -s dist -l 3000 > web.log 2>&1 & # Wait for frontend to start sleep 2 echo "✅ Services started!" echo "" echo "📊 Status Check:" echo " - API Health: http://localhost:3334/health" echo " - V2 Health: http://localhost:3334/v2/health" echo " - Frontend: http://localhost:3000" echo "" echo "🌍 Production URLs:" echo " - Frontend: https://urltrackertool.com" echo " - API: https://api.urltrackertool.com" echo "" echo "📝 Logs:" echo " - API: tail -f /root/catch_redirect/apps/api/api.log" echo " - Frontend: tail -f /root/catch_redirect/apps/web/web.log" echo "" # Quick health check echo "🔍 Quick Health Check:" if curl -s http://localhost:3334/health >/dev/null 2>&1; then echo " ✅ API Server: Running" else echo " ❌ API Server: Not responding" fi if curl -s http://localhost:3000 >/dev/null 2>&1; then echo " ✅ Frontend: Running" else echo " ❌ Frontend: Not responding" fi echo "" echo "🎯 Ready for testing!"