Self-host
Environment variables
Configure database, Clerk, Supabase, and public URLs for Fork.
Create .env.local at the repository root or under apps/web/. Prisma resolves either location.
Required / common variables
| Variable | Purpose |
|---|---|
DATABASE_URL | PostgreSQL connection string (required for lib/db.ts). |
DIRECT_URL | Optional; used by Prisma migrations when bypassing a pooler (falls back to DATABASE_URL). |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Clerk browser key. |
CLERK_SECRET_KEY | Clerk server key. |
NEXT_PUBLIC_SUPABASE_URL | Supabase project URL (also used for Next.js images.remotePatterns). |
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY or NEXT_PUBLIC_SUPABASE_ANON_KEY | Supabase client key. |
SUPABASE_SERVICE_ROLE_KEY or SUPABASE_SECRET_KEY | Server-only Supabase key for storage and admin APIs. |
NEXT_PUBLIC_SUPABASE_ASSET_BUCKET | Storage bucket name (defaults to videos if unset). |
NEXT_PUBLIC_APP_URL | Public site URL for share links and embed snippets (no trailing slash). |
VIEWER_ACCESS_SECRET | Secret for signing viewer-access tokens (optional if CLERK_SECRET_KEY is set). |
Tips
- Never commit real secrets; keep
.env.localout of version control (see repo.gitignore). - For production, set the same keys in your host’s environment (e.g. Vercel project settings).
- After changing
DATABASE_URL, run migrations:bun run db:migrate.