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

# Configuration

> Environment variables for the Xitter server.

Xitter reads these environment variables at startup. Everything else (name, sign-up mode, features, limits, announcement, rules, logos) is set in the [admin panel](/administration/admin-panel).

## Server and database

| Variable | Default | Meaning |
| - | - | - |
| `DATABASE_URL` | `postgres://dev@localhost:5432/xitter` | PostgreSQL connection. |
| `BACKUP_DATABASE_URL` | `DATABASE_URL` | Direct PostgreSQL connection for `pg_dump` when the app uses a pooler. |
| `DB_POOL_MAX` | `20` | Connections the server keeps open. |
| `DB_STATEMENT_TIMEOUT`, `DB_LOCK_TIMEOUT` | `30s`, `10s` | A query running or waiting on a lock longer than this is cancelled. The startup migration has no limit. |
| `PORT` | `3000` | Listen port. |
| `PUBLIC_ORIGIN` | `http://localhost:$PORT` | Address browsers use to reach the instance. |
| `SOURCE_URL` | the Xitter repository | Source link shown to users. |
| `XITTER_VERSION` | `version` in `package.json` | Version reported in `/.well-known/xitter` and compared when an account moves. |

## Files

| Variable | Default | Meaning |
| - | - | - |
| `CLIENT_DIR` | `client` | Where the pinned client is stored. |
| `MEDIA_DIR` | `media` | Uploaded images and videos. |
| `BRANDING_DIR` | `data/branding` | Logos uploaded in the admin panel. |
| `ARCHIVE_DIR`, `ARCHIVE_MAX_MB` | `data/imports`, `1024` | Where uploaded X archives wait while they import, and the largest accepted. |
| `ARCHIVE_MAX_JSON_MB` | `64` | Largest JSON file in an archive that an import reads. It's parsed in memory. |

## Media

| Variable | Default | Meaning |
| - | - | - |
| `FFMPEG`, `FFPROBE` | `ffmpeg`, `ffprobe` | Video tools. |
| `MAX_VIDEO_MB`, `MAX_VIDEO_SECONDS` | `200`, `600` | Starting video limits. You can change them in the admin panel. |
| `EMBED_PROXY` | `https://cors.estrogen.delivery/` | Where link previews are fetched from and their images served, as `<proxy>?url=<link>`. Neither the instance nor its readers reach the linked site. |
| `KLIPY_API_KEY` | unset | GIF search through [Klipy](https://klipy.com). Without it or `TENOR_API_KEY`, the GIF button is hidden. |
| `TENOR_API_KEY` | unset | GIF search through Tenor's v2 API, used when `KLIPY_API_KEY` isn't set. |

## Email

See [Email](/self-hosting/email).

| Variable | Default | Meaning |
| - | - | - |
| `SMTP_URL` | unset | Your own mail server: `smtp://user:pass@host:587` (STARTTLS) or `smtps://user:pass@host:465`. |
| `RESEND_API_KEY` | unset | [Resend](https://resend.com) key, used when `SMTP_URL` isn't set or refused a mail. |
| `MAIL_FROM` | `Xitter <noreply@xit.chococat.lol>` | Sender of the mail. Its domain must be the mail server's, or verified in Resend. |

## Encrypted chat

See [Encrypted chat](/self-hosting/encrypted-chat).

| Variable | Default | Meaning |
| - | - | - |
| `JUICEBOX_URL` | `http://localhost:8580` | Private address of the key-backup realm, proxied through `/juicebox/`. |
| `CHAT_TOKEN_SECRET` | saved in `data/chat-secrets.json` | Signing secret for chat socket tokens. |
| `JUICEBOX_REALM_ID`, `JUICEBOX_TENANT_SECRET` | saved in `data/chat-secrets.json` | Stable realm identity and tenant signing secret. |
| `MAX_CHAT_MEDIA_MB` | `200` | Largest encrypted chat attachment. |

## Federation

See [Federation](/federation/overview).

| Variable | Default | Meaning |
| - | - | - |
| `FEDERATION` | on | `off` stops federating. |
| `FEDERATION_MEDIA` | unset | `store` keeps copies of other instances' media on disk. |
| `FEDERATION_MEDIA_CACHE_MB` | `64` | Memory cache for other instances' media. |

## Networking and security

| Variable | Default | Meaning |
| - | - | - |
| `TRUSTED_PROXIES` | unset | Comma-separated addresses or ranges (`127.0.0.1`, `172.16.0.0/12`) whose `CF-Connecting-IP` header is believed, besides Cloudflare's own ranges. Set it to a Cloudflare tunnel's address. A plain nginx or Caddy passes the visitor's header on, so leave it out of this list. |
| `RATE_LIMITS` | on | `off` turns the rate limits off, for the test scripts. |
| `MIGRATION_ALLOW_HTTP`, `MIGRATION_ALLOW_PRIVATE` | unset | `1` lets an account move from an instance over plain HTTP, or on a private network. For test instances only. |

## Debugging

| Variable | Default | Meaning |
| - | - | - |
| `LOG_REQUESTS` | unset | `1` logs every API call. `errors` also prints the client's error reports. |

> [!NOTE]
>
> The account's country on its About page comes from the `CF-IPCountry` header, which only exists behind Cloudflare. Without it the About page shows no location.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.