3v324v23's picture
Merge Conflict solved | Build error solved
205f25f
Raw History Blame Contribute Delete
2.65 kB
#!/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