Skip to content
Browse guides

Reference

Environment

Public variables, server credentials, and local overrides.

Docs index | Local development | Operations | Contributing

Keep local development, staging, and production separate. These are configuration boundaries, not a claim that every environment is provisioned; check the target before using maintainer commands.

Environment Boundaries

  • Local development uses the Docker-backed Supabase CLI stack.
  • Staging uses its own Supabase Cloud project and its own deploy environment.
  • Production uses a separate Supabase Cloud project with real users.

Do not point local development at production by default.

Maintainers should deploy schema changes through versioned migrations using the Supabase maintainer workflow. Contributors should stay on the local stack unless a maintainer explicitly grants a cloud task.

Public Variables

Public browser values are allowed in web variables prefixed with NEXT_PUBLIC_*.

For Supabase, the canonical web variables are:

NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=

apps/web/lib/supabase/env.ts reads this canonical key first, then the legacy NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY deployment fallback. New local configuration uses the canonical name from apps/web/.env.example.

Secret Variables

Never commit, paste, or include these in examples:

  • Supabase service role keys
  • Supabase secret keys
  • database passwords and pooler URLs
  • Supabase access tokens
  • Resend API keys or SMTP passwords
  • Sentry auth tokens
  • production .env.local files

Secrets live only in controlled systems such as Vercel environment variables, GitHub environment secrets, Supabase dashboard settings, or a maintainer password manager.

Web Runtime Inventory

The web app intentionally keeps a small environment surface:

VariableScopePurpose
NEXT_PUBLIC_SITE_URLPublicCanonical URL outside Vercel.
NEXT_PUBLIC_SUPABASE_URLPublicSupabase API origin.
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYPublicRLS-protected browser access. The legacy NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY remains a temporary deployment fallback.
SUPABASE_SECRET_KEYServer onlyCatalog worker and privileged server operations; SUPABASE_SERVICE_ROLE_KEY is the legacy fallback. Use only a local key for local Supabase.
CRON_SECRETServer onlyAuthenticates Vercel Cron requests to /api/cron/enrich-catalog. Configure it in Project Settings → Environment Variables, not in the Cron Jobs screen.
V0_REFERRAL_URLServer only, optionalCreator Perks destination.
APPLE_MUSIC_DEVELOPER_TOKENServer only, optionalMaintainer-only Apple Music import.
NEXT_PUBLIC_SENTRY_DSNPublic, optionalTelemetry destination. Unset keeps the existing project; an explicit empty value disables telemetry. Use a local collector for isolated verification.
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATEPublic, optionalShared browser/server trace sampling, 0–1; default 0.01 in production and disabled outside production. Invalid values retain 0.01.
SENTRY_AUTH_TOKENBuild only, optionalSource-map upload during deployment.
AI_GATEWAY_API_KEYServer only, optionalStudio source-context generation outside Vercel OIDC.
VERCEL_OIDC_TOKENServer only, temporaryLocal Gateway authentication from the Vercel CLI; it expires and must not be committed.
STUDIO_PROPOSALS_ENABLEDServer only, optional0 disables new Gateway generation while retaining history.
STUDIO_PROPOSAL_MODELServer only, optionalGateway model override; default and budget contract live in catalog research.
KOCTEAU_PERF_*Server only, optionalSampled diagnostic logs; these do not control Sentry trace sampling.

Use apps/web/.env.example as the configuration template. Preserve existing local files when synchronizing devices. Next.js development overrides such as .env.development.local can supersede .env.local; build and development may therefore target different environments. Do not copy a cloud secret into a local example or pull environment files over existing overrides without preserving them.

MusicBrainz does not require an API key. Kocteau identifies itself with a stable User-Agent, stores matches in Supabase, and performs enrichment only through the protected background worker. Do not add MusicBrainz calls to client components or synchronous page rendering.

Contributor Defaults

Contributors should need only:

NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=<local anon key>

Optional analytics and referral variables should be blank unless a maintainer intentionally configures them.

Privileged local Studio/worker checks additionally need the local server-only key from Supabase status and an intentionally configured curator role. Normal public web work does not need Gateway, SMTP, or production credentials. Having a variable configured does not prove its credential is current or a flow has been verified.

Supabase Safety Checklist

  • Enable RLS on tables in exposed schemas.
  • Pair public access with explicit grants and narrow policies.
  • Keep storage write policies scoped to authenticated users and their own user-id folder.
  • Avoid user_metadata for authorization decisions.
  • Do not use service_role in browser code or NEXT_PUBLIC_* variables.
  • Keep destructive SQL in supabase/scripts/maintenance, not in the fresh install path.