#!/bin/bash # DigiHox CRM Service Launcher # Runs both the React frontend and Django backend concurrently FRONTEND_DIR="/home/vignesh/github/crmfrontend" BACKEND_DIR="/home/vignesh/github/crmbackend" echo "==========================================" echo "🚀 Starting DigiHox CRM Local Dev Servers..." echo "==========================================" # Function to handle exit cleanup cleanup() { echo "" echo "==========================================" echo "🛑 Shutting down servers gracefully..." echo "==========================================" kill "$BACKEND_PID" "$FRONTEND_PID" 2>/dev/null exit 0 } # Trap SIGINT (Ctrl+C) and SIGTERM trap cleanup SIGINT SIGTERM # 1. Start Django Backend echo "Starting Django REST Backend on Port 8002..." cd "$BACKEND_DIR" || exit 1 .venv/bin/python manage.py runserver 8002 & BACKEND_PID=$! # Wait a second for Django setup log lines sleep 1.5 # 2. Start Vite Frontend echo "Starting Vite React Frontend..." cd "$FRONTEND_DIR" || exit 1 npm run dev -- --port 3000 & FRONTEND_PID=$! # Wait for background tasks wait