Environment Variables

Read build-time public configuration from extension code while keeping provider secrets in backend functions.

Read a variable

Use requireEnv when the product cannot work without a value. Use env for optional configuration that may be absent.

import { env, requireEnv } from "@/shared/lib/env";

const apiUrl = requireEnv("SUPABASE_URL");       // throws if missing
const optionalFlag = env("PUBLIC_FEATURE_FLAG");  // "" if missing

Secrets in extension code

A value marked secret is intentionally unavailable to browser code. Call a Supabase function and read it there with Deno.env.get().

For the full environment variables system (local vs production, public vs secret, the four generated files), see the Environment Variables page.