veo3/run-dev.sh
2025-09-30 09:49:55 -05:00

81 lines
No EOL
2.1 KiB
Bash
Executable file

#!/bin/bash
# Development startup script
echo "Starting Veo Video Generator in Development Mode"
echo "================================================"
# Check if node_modules exists in frontend
if [ ! -d "frontend/node_modules" ]; then
echo "Frontend dependencies not found. Installing..."
cd frontend
npm install
if [ $? -ne 0 ]; then
echo "Failed to install frontend dependencies"
exit 1
fi
cd ..
fi
# Check if backend virtual environment exists
if [ ! -d "backend/venv" ] && [ ! -d "venv" ]; then
echo "Virtual environment not found. Please create one first:"
echo " python -m venv venv"
echo " source venv/bin/activate"
echo " pip install -r backend/requirements.txt"
exit 1
fi
# Function to cleanup background processes
cleanup() {
echo "Stopping development servers..."
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
exit 0
}
# Set trap to cleanup on script exit
trap cleanup EXIT INT TERM
# Always use development environment files
echo "Setting up development environment files..."
# Copy development environment file for backend (overwrite if exists)
if [ -f "backend/.env.development" ]; then
echo "Using backend development environment file..."
cp backend/.env.development backend/.env
else
echo "Warning: backend/.env.development not found"
fi
# Copy development environment file for frontend (if it exists)
if [ -f "frontend/.env.development" ]; then
echo "Using frontend development environment file..."
cp frontend/.env.development frontend/.env
fi
# Start backend
echo "Starting backend server..."
cd backend
python app.py &
BACKEND_PID=$!
echo "Backend started with PID: $BACKEND_PID"
# Wait a moment for backend to start
sleep 3
# Start frontend
echo "Starting frontend development server..."
cd ../frontend
npm run dev &
FRONTEND_PID=$!
echo "Frontend started with PID: $FRONTEND_PID"
echo ""
echo "Development servers are running:"
echo "- Backend API: http://localhost:7394"
echo "- Frontend: http://localhost:3000"
echo ""
echo "Press Ctrl+C to stop both servers"
# Wait for either process to exit
wait