# Configuration Overview

> Configure a self-hosted LearnHouse instance with environment variables, edit the generated .env file and apply changes with the LearnHouse CLI.

LearnHouse uses environment variables as its primary configuration method. When you run `learnhouse setup`, the CLI generates a `.env` file with all the necessary variables based on your choices.

## Configuration Methods

The API reads its settings from two places:

1. **Environment variables** (the `.env` file the CLI generates): the primary and recommended method
2. **`apps/api/config/config.yaml`** inside the image: defaults for local development

> When a variable is set, it takes precedence over the value in `config.yaml`. The web app and the collaboration server read only environment variables.

## Editing Configuration

Edit variables interactively with the CLI. It offers to restart services when you are done:

```bash
npx learnhouse env
```

Alternatively, edit the `.env` file in your installation directory (`~/.learnhouse/<name>/.env` by default) and apply the change. `start` runs `docker compose up -d`, which recreates the containers whose configuration changed:

```bash
npx learnhouse start
```

To change the domain, re-run `npx learnhouse setup` on the same installation: the URLs, cookie domain and proxy configuration are all generated from it. Your data and secrets are kept.

## Configuration Sections

- [Environment Variables](https://docs.learnhouse.app/self-hosting/configuration/environment-variables): Complete reference of all available environment variables.
- [AI Setup](https://docs.learnhouse.app/self-hosting/configuration/ai-setup): Enable and configure AI-powered features.
- [Email](https://docs.learnhouse.app/self-hosting/configuration/email): Set up email delivery for invitations, password resets, and notifications.
- [Content Storage](https://docs.learnhouse.app/self-hosting/configuration/storage): Configure filesystem or S3-compatible storage for uploaded content.
- [SSL and Domain](https://docs.learnhouse.app/self-hosting/configuration/ssl): Set up your domain name and SSL certificates.
