> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unpod.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Environment variables, development commands, and Docker setup

## Environment Configuration

Copy `.env.example` to `.env` at the repo root. The Docker simple setup passes all variables to containers automatically.

For local development, each app reads config from:

| App            | Config Source                                                 |
| -------------- | ------------------------------------------------------------- |
| `backend-core` | `.env` in its own directory (`DJANGO_READ_DOT_ENV_FILE=True`) |
| `api-services` | `.env` from monorepo root via python-dotenv                   |
| `web`          | `apps/web/.env.local` (copy from `.env.local.example`)        |
| `super`        | `.env` from monorepo root via python-dotenv                   |

***

### Frontend (`apps/web/.env.local`)

| Variable         | Default                                     | Description              |
| ---------------- | ------------------------------------------- | ------------------------ |
| `API_URL`        | `http://localhost:8000`                     | Backend API base URL     |
| `PRODUCT_ID`     | `unpod`                                     | Product identifier       |
| `IS_DEV_MODE`    | `true`                                      | Enable development mode  |
| `CURRENCY`       | `USD`                                       | Default currency         |
| `LIVEKIT_URL`    | `ws://localhost:7880`                       | LiveKit WebSocket URL    |
| `CENTRIFUGO_URL` | `ws://localhost:8000/connection/centrifugo` | Centrifugo WebSocket URL |

### Backend Core (`.env`)

| Variable            | Required | Description                                |
| ------------------- | -------- | ------------------------------------------ |
| `DJANGO_SECRET_KEY` | Yes      | Django secret key                          |
| `POSTGRES_HOST`     | Yes      | PostgreSQL host (`localhost`)              |
| `POSTGRES_PORT`     | Yes      | PostgreSQL port (`5432`)                   |
| `POSTGRES_DB`       | Yes      | Database name (`unpod_db`)                 |
| `POSTGRES_USER`     | Yes      | Database user (`postgres`)                 |
| `POSTGRES_PASSWORD` | Yes      | Database password                          |
| `MONGO_DSN`         | Yes      | MongoDB connection string                  |
| `REDIS_URL`         | Yes      | Redis URL (`redis://localhost:6379/1`)     |
| `BASE_URL`          | Yes      | Backend base URL (`http://localhost:8000`) |
| `BASE_FRONTEND_URL` | Yes      | Frontend URL (`http://localhost:3000`)     |

### Voice AI (`apps/super`)

| Variable             | Required | Description               |
| -------------------- | -------- | ------------------------- |
| `LIVEKIT_URL`        | Yes      | LiveKit WebSocket URL     |
| `LIVEKIT_API_KEY`    | Yes      | LiveKit API key           |
| `LIVEKIT_API_SECRET` | Yes      | LiveKit API secret        |
| `OPENAI_API_KEY`     | Yes      | OpenAI API key            |
| `ANTHROPIC_API_KEY`  | Yes      | Anthropic API key         |
| `DEEPGRAM_API_KEY`   | Yes      | Deepgram STT API key      |
| `CARTESIA_API_KEY`   | Yes      | Cartesia TTS API key      |
| `PREFECT_API_URL`    | Yes      | Prefect orchestration URL |

### Optional Variables

| Variable                  | Description                 |
| ------------------------- | --------------------------- |
| `AWS_ACCESS_KEY_ID`       | S3 storage access key       |
| `AWS_SECRET_ACCESS_KEY`   | S3 storage secret key       |
| `AWS_STORAGE_BUCKET_NAME` | S3 bucket name              |
| `SENDGRID_API_KEY`        | SendGrid API key for emails |

See `.env.example` for the full list.

***

## Development Commands

### Make (uses `docker-compose.simple.yml`)

| Command            | Description                                    |
| ------------------ | ---------------------------------------------- |
| `make quick-start` | Full setup: env + deps + docker + db + migrate |
| `make dev`         | Start frontend + backend dev servers           |
| `make docker`      | Start Docker containers                        |
| `make migrate`     | Run Django migrations                          |
| `make stop`        | Stop Docker containers                         |
| `make clean`       | Stop containers and remove all data            |
| `make logs`        | Tail Docker container logs                     |
| `make superuser`   | Create Django superuser                        |

### NPM

| Command                | Description                       |
| ---------------------- | --------------------------------- |
| `npm run dev`          | Start web + backend-core (via NX) |
| `npm run dev:frontend` | Frontend only (port 3000)         |
| `npm run build`        | Build frontend                    |
| `npm run test`         | Run tests                         |
| `npm run e2e`          | E2E tests (Playwright)            |
| `npm run lint:all`     | Lint all projects                 |
| `npm run graph`        | View NX dependency graph          |

***

## Docker

### Development Setup (Recommended)

Uses `docker-compose.simple.yml` - single PostgreSQL instance, all services pre-configured:

```bash theme={null}
docker compose -f docker-compose.simple.yml up -d        # Start
docker compose -f docker-compose.simple.yml logs -f       # Logs
docker compose -f docker-compose.simple.yml down          # Stop
docker compose -f docker-compose.simple.yml down -v       # Stop + remove data
```

| Container            | Port  | Service       |
| -------------------- | ----- | ------------- |
| `unpod-postgres`     | 5432  | PostgreSQL 16 |
| `unpod-mongodb`      | 27017 | MongoDB 7     |
| `unpod-redis`        | 6379  | Redis 7       |
| `unpod-centrifugo`   | 8100  | Centrifugo v5 |
| `unpod-backend-core` | 8000  | Django API    |
| `unpod-api-services` | 9116  | FastAPI       |
| `unpod-web`          | 3000  | Next.js       |

### Full Infrastructure

Uses `docker-compose.yml` - separate PostgreSQL per service + Kafka (KRaft). For microservices development:

```bash theme={null}
docker compose up -d
```

***

## Database Commands

```bash theme={null}
cd apps/backend-core

# Run migrations
python manage.py migrate

# Create new migrations after model changes
python manage.py makemigrations

# Seed reference data
python manage.py seed_reference_data

# Setup scheduled tasks
python manage.py setup_schedules
```

***

## Testing and Quality

```bash theme={null}
cd apps/backend-core

# Run tests
pytest

# Run tests with coverage
pytest --cov

# Type checking
mypy unpod

# Code formatting
black unpod
```

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Architecture" icon="layers" href="/platform/self-hosting/architecture">
    Monorepo structure, tech stack, and services overview.
  </Card>

  <Card title="API Documentation" icon="code" href="/api/get-started/quickstart">
    Programmatic access to the Unpod platform.
  </Card>
</CardGroup>
