config-email/start.sh

72 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
echo "🚀 Starting Email Configuration Manager..."
echo ""
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Check for Node.js
if ! command_exists node; then
echo "❌ Error: Node.js is not installed"
echo "Please install Node.js 18+ from https://nodejs.org"
exit 1
fi
echo "✅ Node.js version: $(node --version)"
echo ""
# Check if dependencies are installed
if [ ! -d "backend/node_modules" ]; then
echo "📦 Installing backend dependencies..."
cd backend && npm install && cd ..
echo ""
fi
if [ ! -d "frontend/node_modules" ]; then
echo "📦 Installing frontend dependencies..."
cd frontend && npm install && cd ..
echo ""
fi
# Start backend in background
echo "🔧 Starting Backend API on port 3001..."
cd backend
npm start &
BACKEND_PID=$!
cd ..
# Wait a bit for backend to start
sleep 3
# Start frontend
echo "🎨 Starting Frontend on port 3008..."
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✨ Application is running!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "🌐 Frontend: http://localhost:3008"
echo "🔌 Backend: http://localhost:3001"
echo ""
echo "Press Ctrl+C to stop both servers"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
cd frontend
npm run dev -- --port 3008
# Cleanup function
cleanup() {
echo ""
echo "🛑 Shutting down servers..."
kill $BACKEND_PID 2>/dev/null
exit 0
}
trap cleanup INT TERM
wait