ForkDocs
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

VariablePurpose
DATABASE_URLPostgreSQL connection string (required for lib/db.ts).
DIRECT_URLOptional; used by Prisma migrations when bypassing a pooler (falls back to DATABASE_URL).
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClerk browser key.
CLERK_SECRET_KEYClerk server key.
NEXT_PUBLIC_SUPABASE_URLSupabase project URL (also used for Next.js images.remotePatterns).
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY or NEXT_PUBLIC_SUPABASE_ANON_KEYSupabase client key.
SUPABASE_SERVICE_ROLE_KEY or SUPABASE_SECRET_KEYServer-only Supabase key for storage and admin APIs.
NEXT_PUBLIC_SUPABASE_ASSET_BUCKETStorage bucket name (defaults to videos if unset).
NEXT_PUBLIC_APP_URLPublic site URL for share links and embed snippets (no trailing slash).
VIEWER_ACCESS_SECRETSecret for signing viewer-access tokens (optional if CLERK_SECRET_KEY is set).

Tips

  • Never commit real secrets; keep .env.local out 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.

On this page