#!/bin/bash # 🏦 BeFree Bank Statement Processor — Development Quick Start # Starts both the backend API server and the frontend dev server set -e PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$PROJECT_DIR" # Colors for output GREEN='\033[0;32m' BLUE='\033[0;34m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' echo -e "${BLUE}" echo "╔════════════════════════════════════════════════════════════╗" echo "║ 🏦 BeFree Bank Statement Processor ║" echo "║ FastAPI Backend + Next.js Frontend ║" echo "╚════════════════════════════════════════════════════════════╝" echo -e "${NC}" # Check Python echo -e "${YELLOW}[1/4]${NC} Checking Python version..." python3 --version || python --version # Setup virtual environment echo -e "${YELLOW}[2/4]${NC} Setting up Python environment..." if [ ! -d "venv" ] && [ ! -d ".venv" ]; then echo -e "${YELLOW}Creating virtual environment...${NC}" python3 -m venv venv || python -m venv venv fi # Activate venv if [ -d "venv" ]; then source venv/bin/activate elif [ -d ".venv" ]; then source .venv/bin/activate fi # Install Python deps echo -e "${YELLOW}[3/4]${NC} Installing Python dependencies..." pip install -q fastapi "uvicorn[standard]" python-multipart python-dotenv PyMuPDF openpyxl google-generativeai 2>/dev/null pip install -q -e shared -e bank-extractor -e "bank-hitl[web]" -e bank-classifier 2>/dev/null # Install frontend deps echo -e "${YELLOW}[4/4]${NC} Installing frontend dependencies..." cd befree-frontend npm install --silent 2>/dev/null cd .. echo -e "${GREEN}✅ Setup complete!${NC}" echo "" # Start backend in background echo -e "${BLUE}Starting Backend API (port 8000)...${NC}" python api_server.py & BACKEND_PID=$! # Start frontend echo -e "${BLUE}Starting Frontend (port 3000)...${NC}" cd befree-frontend npm run dev & FRONTEND_PID=$! cd .. echo "" echo -e "${GREEN}🚀 BeFree is running!${NC}" echo -e " 📱 Frontend: ${GREEN}http://localhost:3000${NC}" echo -e " 🔧 Backend: ${GREEN}http://localhost:8000${NC}" echo -e " 📚 API Docs: ${GREEN}http://localhost:8000/docs${NC}" echo "" echo -e "${YELLOW}Press Ctrl+C to stop both servers${NC}" # Cleanup on exit trap "kill $BACKEND_PID $FRONTEND_PID 2>/dev/null; exit" SIGINT SIGTERM wait