#!/bin/bash

echo "Starting Wedding Guest List Application..."
echo

echo "[1/3] Starting PostgreSQL (make sure it's running)"
sleep 2

echo "[2/3] Starting Backend Server..."
cd backend
uvicorn main:app --reload &
BACKEND_PID=$!
cd ..
sleep 3

echo "[3/3] Starting Frontend..."
cd frontend
npm run dev &
FRONTEND_PID=$!
cd ..

echo
echo "========================================"
echo "Application is running!"
echo "========================================"
echo
echo "Backend API: http://localhost:8000"
echo "API Docs: http://localhost:8000/docs"
echo "Frontend: http://localhost:5173"
echo
echo "Press Ctrl+C to stop all services"

# Wait for Ctrl+C
trap "kill $BACKEND_PID $FRONTEND_PID; exit" INT
wait
