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

# Environment Variables

> Complete reference for all configuration variables across services.

# Environment Variables

Nenyax is **envless by default** — no `.env` files are needed for local development. All infrastructure defaults are hardcoded in the code to match the docker-compose port mappings.

Provider API keys (LiveKit, Google, Resemble, Twilio, STT) are managed through the **API Keys** dashboard page, encrypted in the database.

## When are `.env` files needed?

| Mode                                                 | `.env` files needed?                         |
| ---------------------------------------------------- | -------------------------------------------- |
| **Local dev** (DB + MinIO in Docker, services local) | **No** — code defaults work                  |
| **Docker dev** (`docker compose up`)                 | Root `.env` optional — compose has defaults  |
| **Production** (`docker-compose.prod.yml`)           | Root `.env` auto-generated by install script |

Only create a `.env` file if you need to **override** a default.

## Local Dev Defaults

These are hardcoded in `config.py`, `auth.ts`, and `api.ts`:

| Setting                   | Default                                              | Notes                          |
| ------------------------- | ---------------------------------------------------- | ------------------------------ |
| `POSTGRES_PASSWORD`       | `nenyax`                                             | Matches docker-compose default |
| `DB_HOST`                 | `localhost`                                          |                                |
| `DB_PORT`                 | `5434`                                               | docker-compose maps 5434→5432  |
| `MINIO_ENDPOINT`          | `localhost:9002`                                     | docker-compose maps 9002→9000  |
| `MINIO_ACCESS_KEY`        | `minioadmin`                                         |                                |
| `MINIO_SECRET_KEY`        | `minioadmin`                                         |                                |
| `MINIO_BUCKET`            | `nenyax`                                             |                                |
| `FRONTEND_URL`            | `http://localhost:3000`                              | CORS origin                    |
| `NEXT_PUBLIC_API_URL`     | `http://localhost:8000/api`                          |                                |
| `BETTER_AUTH_SECRET`      | `authsecret123`                                      | Override in production         |
| `DATABASE_URL` (frontend) | `postgresql://postgres:nenyax@localhost:5434/nenyax` |                                |

## Root `.env` (Docker Compose)

Only used when running via `docker compose up`. The compose files have defaults, so this is optional for dev:

| Variable              | Default         | Description                                         |
| --------------------- | --------------- | --------------------------------------------------- |
| `POSTGRES_PASSWORD`   | `nenyax`        | PostgreSQL password                                 |
| `BETTER_AUTH_SECRET`  | `authsecret123` | Session encryption secret (override for production) |
| `MINIO_ROOT_USER`     | `minioadmin`    | MinIO access key                                    |
| `MINIO_ROOT_PASSWORD` | `minioadmin`    | MinIO secret key                                    |

## Backend (`backend/.env`)

**Not needed for local dev.** All defaults are in `config.py`. Only create to override:

| Variable            | Default     | Description                                       |
| ------------------- | ----------- | ------------------------------------------------- |
| `POSTGRES_PASSWORD` | `nenyax`    | PostgreSQL password                               |
| `DATABASE_URL`      | Auto-built  | Full connection string (overrides auto-built URL) |
| `DB_HOST`           | `localhost` | Set to `postgres` in Docker                       |
| `DB_PORT`           | `5434`      | Set to `5432` in Docker                           |

Provider keys set in `.env` are used as fallback — the dashboard takes priority.

## Frontend (`frontend/.env`)

**Not needed for local dev.** All defaults are in `auth.ts` and `api.ts`. Only create to override:

| Variable              | Default                                              | Description          |
| --------------------- | ---------------------------------------------------- | -------------------- |
| `NEXT_PUBLIC_API_URL` | `http://localhost:8000/api`                          | Backend API URL      |
| `DATABASE_URL`        | `postgresql://postgres:nenyax@localhost:5434/nenyax` | Better Auth database |
| `BETTER_AUTH_SECRET`  | `authsecret123`                                      | Session encryption   |
| `BETTER_AUTH_URL`     | `http://localhost:3000`                              | Auth callback URL    |

## Agent

**No `.env` file needed.** On startup, it calls the backend's `/api/settings/keys/agent` endpoint and injects all keys into the process environment.

| Variable          | Default                     | Description                        |
| ----------------- | --------------------------- | ---------------------------------- |
| `BACKEND_API_URL` | `http://localhost:8000/api` | Only set if backend runs elsewhere |

## Dashboard-Managed Keys

These keys are configured at **API Keys** in the dashboard. They are encrypted with AES-256-GCM and stored in the database.

| Provider    | Keys                            | Purpose                                    |
| ----------- | ------------------------------- | ------------------------------------------ |
| LiveKit     | API Key, API Secret, Server URL | Real-time voice infrastructure             |
| Google      | API Key                         | Gemini LLM for conversational intelligence |
| Resemble AI | API Key                         | Text-to-speech voice synthesis             |
| Twilio      | Account SID, Auth Token         | Phone number management and SIP telephony  |
| AssemblyAI  | API Key                         | Speech-to-text (STT option)                |
| Deepgram    | API Key                         | Speech-to-text (STT option)                |
| ElevenLabs  | API Key                         | Speech-to-text (STT option)                |

## Auto-Provisioned (No Config Needed)

These were previously environment variables but are now fully automated:

| Old Variable           | What Happens Now                                    |
| ---------------------- | --------------------------------------------------- |
| `TWILIO_SIP_DOMAIN`    | Auto-derived from `LIVEKIT_URL`                     |
| `LIVEKIT_SIP_TRUNK_ID` | Auto-provisioned on first outbound call             |
| `ENCRYPTION_KEY`       | Auto-generated and stored in database on first boot |
| `FRONTEND_URL`         | Defaults to `http://localhost:3000`                 |
| `PORT`                 | Defaults to `8000`                                  |
| `DEBUG`                | Defaults to `true`                                  |

## Custom Agent Infrastructure

These variables are only needed if you override the defaults for custom Python agents:

| Variable                    | Default                       | Description                          |
| --------------------------- | ----------------------------- | ------------------------------------ |
| `MINIO_ENDPOINT`            | `localhost:9002`              | MinIO server address                 |
| `MINIO_ACCESS_KEY`          | `minioadmin`                  | MinIO access key                     |
| `MINIO_SECRET_KEY`          | `minioadmin`                  | MinIO secret key                     |
| `MINIO_BUCKET`              | `nenyax`                      | MinIO bucket name                    |
| `DOCKER_SOCKET`             | `unix:///var/run/docker.sock` | Docker socket path                   |
| `BASE_AGENT_IMAGE`          | `nenyax-agent-base:latest`    | Base Docker image for custom agents  |
| `CONTAINER_NETWORK`         | `nenyax_default`              | Docker network for agent containers  |
| `CONTAINER_TIMEOUT_SECONDS` | `3600`                        | Timeout for custom agent containers  |
| `CODING_AGENT_PROVIDER`     | `gemini`                      | AI provider for the coding assistant |

## Telemetry

| Variable                | Default | Description                                                     |
| ----------------------- | ------- | --------------------------------------------------------------- |
| `NEXT_PUBLIC_TELEMETRY` | `true`  | Set to `false` to disable anonymous product telemetry (PostHog) |

Nenyax collects anonymous usage telemetry (page views, feature usage) via PostHog to help improve the product. No personal data or conversation content is collected. Set `NEXT_PUBLIC_TELEMETRY=false` to opt out.
