#!/bin/bash # Team Chat - Setup Script set -e echo "🚀 Team Chat Setup Script" echo "==========================" # Check if Docker is available if command -v docker &> /dev/null && command -v docker-compose &> /dev/null; then echo "" echo "✅ Docker and Docker Compose found" echo "" read -p "Do you want to use Docker? (Y/n): " use_docker use_docker=${use_docker:-Y} else use_docker="n" fi if [[ $use_docker =~ ^[Yy]$ ]]; then echo "" echo "📦 Starting with Docker..." # Build and start containers docker-compose up -d --build echo "" echo "⏳ Waiting for services to be ready..." sleep 10 echo "" echo "✅ Services started!" echo "" echo "Backend API: http://localhost:8000" echo "Frontend: http://localhost:5173" echo "API Docs: http://localhost:8000/docs" echo "" read -p "Do you want to create demo data? (Y/n): " create_demo create_demo=${create_demo:-Y} if [[ $create_demo =~ ^[Yy]$ ]]; then echo "" echo "📊 Creating demo data..." sleep 5 python3 scripts/create_demo_data.py fi else echo "" echo "📦 Manual setup..." # Backend setup echo "" echo "1️⃣ Setting up Backend..." cd backend if [ ! -d "venv" ]; then echo " Creating virtual environment..." python3 -m venv venv fi echo " Activating virtual environment..." source venv/bin/activate echo " Installing dependencies..." pip install -r requirements.txt if [ ! -f ".env" ]; then echo " Creating .env file..." cp .env.example .env echo " ⚠️ Please edit backend/.env with your PostgreSQL credentials" fi echo "" echo " Starting backend server..." uvicorn app.main:app --reload & BACKEND_PID=$! cd .. # Frontend setup echo "" echo "2️⃣ Setting up Frontend..." cd frontend if [ ! -d "node_modules" ]; then echo " Installing dependencies..." npm install fi echo "" echo " Starting frontend dev server..." npm run dev & FRONTEND_PID=$! cd .. echo "" echo "✅ Services started!" echo "" echo "Backend API: http://localhost:8000" echo "Frontend: http://localhost:5173" echo "" echo "Press Ctrl+C to stop all services" # Wait for Ctrl+C trap "kill $BACKEND_PID $FRONTEND_PID 2>/dev/null" EXIT wait fi