Environment reference

Environment reference

Copy .env.example to .env.local only if you are pasting keys by hand. pnpm supabase:setup already writes the two public Supabase values.

Never commit .env.local, the service-role key, or RESEND_API_KEY. Variables prefixed NEXT_PUBLIC_ are sent to the browser.

VariableWhereRequiredSource
NEXT_PUBLIC_SUPABASE_URLBrowserYesSupabase → Project Settings → API. Setup script writes this.
NEXT_PUBLIC_SUPABASE_ANON_KEYBrowserYes (or publishable key)Supabase anon / publishable key.
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYBrowserAlternate for the anon keyNewer hosted projects may show this name. Either key works.
SUPABASE_SERVICE_ROLE_KEYServer/CLIScripts onlyDashboard API keys. Never import this in src/. Used by pnpm demo:files and pnpm rls:test.
SUPABASE_PROJECT_REFCLIIf you already have projectsProject ref in the dashboard URL.
SUPABASE_DB_PASSWORDCLIExisting project migrationsDatabase password. Stored in supabase/.temp/ (gitignored) when setup creates the project.
SUPABASE_ORG_IDCLIOptionalOrg for a newly created project.
SUPABASE_REGIONCLIOptional, default us-east-1Region for a newly created project.
RESEND_API_KEYServer/CLIOptionalResend. Auth SMTP via pnpm supabase:smtp. In-app notification emails use the same key.
RESEND_FROMServerOptionalDefault ClientNest <onboarding@resend.dev>. Verify a domain before mailing other inboxes.
DEMO_MODEServerOptionalSet true on the hosted public demo only. Blocks writes. Leave unset on your own install.
NEXT_PUBLIC_DEMO_MODEBrowserOptionalSame flag if the public login page should offer one-click demo access.
NEXT_PUBLIC_DEMO_URLBrowserOptionalAbsolute URL for “Open the live demo” on the landing page.

Public vs server-only

  • NEXT_PUBLIC_* values are compile-time public. Treat them as visible to every visitor.
  • SUPABASE_SERVICE_ROLE_KEY bypasses RLS. It belongs in GitHub Actions secrets or a local .env.local, never in client components.
  • RESEND_API_KEY is server-only. Missing is a silent skip for in-app email; the product still works.

Rotating secrets

  1. Roll the key in the Supabase or Resend dashboard.
  2. Update .env.local and the Vercel or Netlify project env.
  3. Redeploy. Old anon keys stop working after they are revoked.
  4. Do not rotate the Harbor demo password in seed unless you also update the docs and Playwright specs.