================================================================================
                    FAMILY HUB - WINDOWS QUICK START
================================================================================

IMPORTANT: Follow these steps IN ORDER!

================================================================================
STEP 1: Download Source Code (MUST DO FIRST!)
================================================================================

Run this command:
    
    download-source.bat

This will:
- Download the complete Family Hub source code from Gitea
- Copy backend/ and frontend/ folders with all files
- You MUST do this before running setup.bat!

What it does:
- If you have Git installed: clones the repository
- If you don't have Git: downloads and extracts using PowerShell


================================================================================
STEP 2: Run Setup (One-Time Only)
================================================================================

After source code is downloaded, run:

    setup.bat

This will:
- Create Python virtual environment (backend/venv/)
- Install all Python dependencies
- Install all Node.js dependencies
- Initialize SQLite database with demo data

This takes a few minutes on first run.


================================================================================
STEP 3: Start the Application
================================================================================

Choose one option:

OPTION A - Two Separate Terminals (Recommended for Development):
    Terminal 1:  start-backend.bat
    Terminal 2:  start-frontend.bat

OPTION B - Single Command (Launches Both):
    start-all.bat

The application will be available at:
    Frontend: http://localhost:5173
    Backend:  http://localhost:8001


================================================================================
STEP 4: Login
================================================================================

Admin Account:
    Username: jess
    Password: password123

Other Family Members:
    lou / password123
    william / password123
    xander / password123
    bella / password123


================================================================================
Stopping the Application
================================================================================

To stop all services:
    
    stop-all.bat


================================================================================
Troubleshooting
================================================================================

If download-source.bat fails:
- Check internet connection
- Try accessing: https://gitea.hideawaygaming.com.au/jessikitty/family-hub
- Make sure you can access the Gitea server

If setup.bat fails:
- Make sure you ran download-source.bat FIRST!
- Check that Python is installed: python --version
- Check that Node.js is installed: node --version

If ports are in use:
- Run: stop-all.bat
- Or manually kill processes:
    netstat -ano | findstr :8001
    taskkill /PID <PID> /F


================================================================================
Files Overview
================================================================================

After running download-source.bat, you'll have:

D:\hosted\familyhub\
├── download-source.bat    <- Downloads source code
├── setup.bat             <- One-time setup
├── start-backend.bat     <- Start backend
├── start-frontend.bat    <- Start frontend
├── start-all.bat        <- Start both
├── stop-all.bat         <- Stop all
├── README.md            <- Full documentation
├── backend\
│   ├── app\             <- Python source code (from Gitea)
│   ├── migrations\      <- Database scripts
│   ├── requirements.txt <- Python dependencies (from Gitea)
│   ├── .env            <- Backend configuration
│   ├── init_db.py      <- Database initialization
│   ├── venv\           <- Virtual environment (created by setup)
│   └── data\           <- Database files (created by setup)
└── frontend\
    ├── src\            <- React source code (from Gitea)
    ├── package.json    <- Node dependencies (from Gitea)
    ├── .env           <- Frontend configuration
    └── node_modules\  <- Node packages (created by setup)


================================================================================
For detailed information, see README.md
================================================================================
