@echo off title BankBot AI — Launcher echo. echo ============================================================ echo BankBot AI ^| One-Click Launcher echo Frontend : http://localhost:3000 echo Backend : http://localhost:8000 echo API Docs : http://localhost:8000/docs echo ============================================================ echo. REM ── Step 1: Check Python ──────────────────────────────────────────────────── python --version >nul 2>&1 if errorlevel 1 ( echo [ERROR] Python not found. echo Install Python 3.11+ from https://python.org echo During install, tick "Add Python to PATH" pause exit /b 1 ) echo [OK] Python found REM ── Step 2: Check Node.js ─────────────────────────────────────────────────── node --version >nul 2>&1 if errorlevel 1 ( echo [ERROR] Node.js not found. echo Install Node.js 18+ from https://nodejs.org pause exit /b 1 ) echo [OK] Node.js found REM ── Step 3: Create backend venv if missing ────────────────────────────────── if not exist "backend\venv\Scripts\python.exe" ( echo. echo [SETUP] Creating Python virtual environment... python -m venv backend\venv if errorlevel 1 ( echo [ERROR] Failed to create virtual environment. pause exit /b 1 ) echo [OK] Virtual environment created ) else ( echo [OK] Virtual environment exists ) REM ── Step 4: Install backend dependencies if not yet installed ─────────────── backend\venv\Scripts\python.exe -c "import uvicorn" >nul 2>&1 if errorlevel 1 ( echo. echo [SETUP] Installing backend dependencies ^(first run, ~2 min^)... backend\venv\Scripts\pip.exe install -r backend\requirements.txt --quiet if errorlevel 1 ( echo [ERROR] Failed to install backend dependencies. pause exit /b 1 ) echo [OK] Backend dependencies installed ) else ( echo [OK] Backend dependencies already installed ) REM ── Step 5: Install frontend dependencies if missing ──────────────────────── if not exist "frontend\node_modules\next\package.json" ( echo. echo [SETUP] Installing frontend dependencies ^(first run, ~1 min^)... cd frontend npm install --legacy-peer-deps --silent if errorlevel 1 ( echo [ERROR] Failed to install frontend dependencies. cd .. pause exit /b 1 ) cd .. echo [OK] Frontend dependencies installed ) else ( echo [OK] Frontend dependencies already installed ) REM ── Step 6: Create backend .env if missing ────────────────────────────────── if not exist "backend\.env" ( echo. echo [SETUP] Creating backend\.env ... ( echo USE_SQLITE=true echo JWT_SECRET_KEY=bankbot-local-dev-secret-change-in-prod echo ACCESS_TOKEN_EXPIRE_MINUTES=60 echo BACKEND_CORS_ORIGINS=["http://localhost:3000"] ) > backend\.env echo [OK] backend\.env created echo [TIP] Open backend\.env and add your GROQ_API_KEY for live AI chat echo Get a free key at: https://console.groq.com/keys ) else ( echo [OK] backend\.env exists ) REM ── Step 7: Seed demo data only if database is empty ──────────────────────── echo. echo [1/2] Checking demo data... backend\venv\Scripts\python.exe -c "import sys,os; sys.path.insert(0,'backend'); os.chdir('backend'); os.environ.setdefault('USE_SQLITE','true'); from app.database.database import SessionLocal; from app.database.models import User; db=SessionLocal(); c=db.query(User).count(); db.close(); sys.exit(0 if c>0 else 1)" >nul 2>&1 if errorlevel 1 ( echo [SEED] Seeding demo account ^(alex@bankbot.dev^)... cd backend call venv\Scripts\activate.bat python app\scripts\seed_demo.py if errorlevel 1 ( echo [WARN] Seed had warnings — continuing anyway ) else ( echo [OK] Demo account seeded ) cd .. ) else ( echo [OK] Demo data already present — skipping seed ) REM ── Step 8: Free ports 3000 and 8000 if already occupied ──────────────────── echo. echo [CLEAN] Freeing ports 3000 and 8000... for /f "tokens=5" %%a in ('netstat -ano 2^>nul ^| findstr ":3000 " ^| findstr "LISTENING"') do ( taskkill /PID %%a /F >nul 2>&1 ) for /f "tokens=5" %%a in ('netstat -ano 2^>nul ^| findstr ":8000 " ^| findstr "LISTENING"') do ( taskkill /PID %%a /F >nul 2>&1 ) echo [OK] Ports are free REM ── Step 9: Start backend in its own window ────────────────────────────────── echo. echo [2/2] Launching services... start "BankBot Backend" cmd /k "title BankBot Backend (port 8000) & cd /d "%~dp0backend" & call venv\Scripts\activate.bat & echo. & echo Backend: http://localhost:8000 & echo Docs: http://localhost:8000/docs & echo Press Ctrl+C to stop. & echo. & uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload" REM ── Step 10: Wait for backend to be ready (max 30 seconds) ────────────────── echo [WAIT] Waiting for backend to start... set TRIES=0 :WAIT_BACKEND set /a TRIES=%TRIES%+1 if %TRIES% GTR 30 goto BACKEND_TIMEOUT timeout /t 1 /nobreak >nul curl -s -o nul http://localhost:8000/health if errorlevel 1 goto WAIT_BACKEND echo [OK] Backend is ready ^(took %TRIES% seconds^) goto BACKEND_READY :BACKEND_TIMEOUT echo [WARN] Backend taking longer than usual — continuing anyway :BACKEND_READY REM ── Step 11: Start frontend in its own window ──────────────────────────────── start "BankBot Frontend" cmd /k "title BankBot Frontend (port 3000) & cd /d "%~dp0frontend" & echo. & echo Frontend: http://localhost:3000 & echo Press Ctrl+C to stop. & echo. & npm run dev" REM ── Step 12: Wait for frontend to compile, then open browser ───────────────── echo [WAIT] Waiting for frontend to compile ^(~8 seconds^)... timeout /t 8 /nobreak >nul start "" http://localhost:3000 REM ── All done ────────────────────────────────────────────────────────────────── echo. echo ============================================================ echo BankBot AI is running! echo. echo Frontend : http://localhost:3000 echo Backend : http://localhost:8000 echo API Docs : http://localhost:8000/docs echo Metrics : http://localhost:8000/api/metrics echo Health : http://localhost:8000/health echo. echo Demo Login : echo Email : alex@bankbot.dev echo Password : BankBot2026! echo. echo Two terminal windows are now open: echo "BankBot Backend" — close to stop the API echo "BankBot Frontend" — close to stop the UI echo. echo Run this file again any time to restart. echo ============================================================ echo. pause