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

# Domain & Multi-Tenant Hosting

> How Streamly resolves tenants from Host headers — platform host, reserved slugs, *.streamly.watch, and Cloudflare for SaaS.

Tenant resolution is **host-based**. Streamly reads the normalized `Host` header (works behind any proxy that preserves it).

## Host patterns

| Host                                                | Tenant                       |
| --------------------------------------------------- | ---------------------------- |
| `NEXT_PUBLIC_PLATFORM_HOST` (e.g. `streamly.watch`) | Default / brand tenant       |
| `localhost` / `*.workers.dev`                       | Dev / preview default tenant |
| `{slug}.streamly.watch`                             | Tenant matched by slug       |
| Custom hostname                                     | Row in `tenant_domains`      |

## Reserved platform hosts & slugs

Reserved hostnames include `streamly.watch`, `www`, `admin`, `app`, `api`.

Reserved **subdomain slugs** (cannot be used as tenant slugs): `www`, `api`, `admin`, `app`, **`customers`** (`RESERVED_SUBDOMAINS` in `lib/streamly/tenant-context.ts`). The SaaS fallback host is typically `customers.streamly.watch`.

## Environment

| Variable                                         | Purpose                         |
| ------------------------------------------------ | ------------------------------- |
| `NEXT_PUBLIC_APP_URL`                            | Canonical public URL            |
| `NEXT_PUBLIC_PLATFORM_HOST`                      | Platform host (no scheme)       |
| `NEXT_PUBLIC_STREAMLY_API_BASE`                  | Usually `https://host/api/v1`   |
| `PUBLIC_CATALOG_TENANT_SLUG` / `DEV_TENANT_SLUG` | Optional pin for default tenant |

## Cloudflare for SaaS (optional)

Automated custom-hostname provisioning uses:

```bash theme={null}
CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_ZONE_ID=
CLOUDFLARE_CUSTOM_HOSTNAMES_API_TOKEN=
CLOUDFLARE_SAAS_FALLBACK_HOST=customers.streamly.watch
```

Without these, the app still runs; you manage DNS/TLS yourself. APIs: `/api/v1/domains`.

## Admin / dashboard hosting

`/admin` and `/dashboard` are served on the **platform host**. Visiting them on a tenant host redirects to `NEXT_PUBLIC_PLATFORM_HOST`.

## Related

* [Platform Architecture](/introduction/platform-architecture)
* [Deploy Cloudflare](/getting-started/deploy-cloudflare)
* [Cloudflare Workers](/technical/cloudflare-workers)
