# Quickstart: Multi-User Auth

## Prerequisites

-   Python 3.9+
-   Node.js 18+
-   Existing project environment

## Setup

1.  **Install Dependencies**:
    ```bash
    pip install "passlib[bcrypt]" "python-jose[cryptography]" "Authlib" "sqlalchemy"
    ```

2.  **Initialize Database**:
    Run the migration script to create `auth.db` and tables.
    ```bash
    python backend/src/scripts/init_auth_db.py
    ```

3.  **Create Admin User**:
    Use the CLI tool to create the initial superuser.
    ```bash
    python backend/src/scripts/create_admin.py --username admin --password securepassword
    ```

## Running the Application

1.  **Start Backend**:
    ```bash
    cd backend
    uvicorn src.app:app --reload
    ```

2.  **Start Frontend**:
    ```bash
    cd frontend
    npm run dev
    ```

3.  **Login**:
    Navigate to `http://localhost:5173/login` and use the admin credentials created above.

## Configuring ADFS

1.  Set environment variables in `.env`:
    ```ini
    ADFS_CLIENT_ID=your-client-id
    ADFS_CLIENT_SECRET=your-client-secret
    ADFS_METADATA_URL=https://fs.your-company.com/adfs/.well-known/openid-configuration
    ```

2.  Configure Group Mappings via the Admin UI or API.