# Self-Hosting Backend

Run your own Coderrr backend for privacy or customization.

## Requirements

- Python >= 3.8
- pip

## Setup

```
# Clone repository
git clone https://github.com/Akash-nath29/Coderrr.git
cd Coderrr/backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
```

## Configure

Create `backend/.env`:

```
# Default provider for users without config
DEFAULT_PROVIDER=azure
GITHUB_TOKEN=your_github_token

# Or use a different default
DEFAULT_PROVIDER=openai
OPENAI_API_KEY=sk-...
```

## Run

```
uvicorn main:app --reload --port 8000
```

Backend available at `http://localhost:8000`

## Point CLI to Your Backend

```
# Option 1: Environment variable
export CODERRR_BACKEND=http://localhost:8000

# Option 2: Config file
echo "CODERRR_BACKEND=http://localhost:8000" > ~/.coderrr/.env

# Option 3: Command line
coderrr --backend http://localhost:8000
```
