> ## 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.

# Supabase

> Connect Streamly to a fresh Supabase project — migrations, Auth settings, and required environment keys.

Supabase is Streamly’s **control plane**: Postgres, Auth, storage buckets used by the app, and RLS policies.

## 1 — Create a project

Create a **fresh** project. Do not reuse retired Streamly credentials from old environments.

## 2 — Apply migrations

Apply every file in `supabase/migrations/` in **numeric filename order**. There is no combined `schema.sql`.

Example domains covered: control plane, catalog, sources, viewers, billing, RLS, plugins, Live TV, theme packages, contact, downloads.

See [Database Schema](/technical/database-schema).

## 3 — Environment keys

| Variable                        | Role                       |
| ------------------------------- | -------------------------- |
| `NEXT_PUBLIC_SUPABASE_URL`      | Project URL (public)       |
| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Anon key (public)          |
| `SUPABASE_SERVICE_ROLE_KEY`     | Server-only privileged key |

## 4 — Auth recommendations

For OTT-length sessions (from `.env.example` notes):

| Setting                    | Suggestion                                               |
| -------------------------- | -------------------------------------------------------- |
| JWT expiry                 | `604800` (7 days, max)                                   |
| Session inactivity timeout | `96h` (4 days) or rely on app idle cookie                |
| Short session timebox      | Avoid — viewers stay signed in until logout or long idle |

Callback route: `/auth/callback`.

## 5 — Verify

Use admin flows / `/api/admin` supabase-check style endpoints after deploy, and confirm operator + viewer login both work with **separate** cookie scopes.

## Related

* [Authentication Flow](/authentication/authentication-flow)
* [Environment Variables](/technical/environment-variables)
* [Security](/technical/security)
