Cloud
Secrets
Encrypted storage for API keys and sensitive values. Available only in edge functions, never transferred to the client.
Adding a secret
- Open Cloud → Secrets.
- Click Add secret.
- Enter a name (uppercase, e.g.,
STRIPE_SECRET_KEY) and value. - Save. The secret is available immediately, no redeploy needed.
Reading in an edge function
ts
Deno.serve(async (req) => {
const apiKey = Deno.env.get("STRIPE_SECRET_KEY");
if (!apiKey) return new Response("Missing key", { status: 500 });
// use it
});Predefined secrets
SUPABASE_URLSUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEY(only in edge functions!)SUPABASE_DB_URLMASTER_API_KEY— for AI Gateway
Best practices
Never store private keys in the frontend or in
VITE_* variables.- Use the service role key exclusively in edge functions.
- Log only the names of the secrets, never the values.
Key rotation
- Generate a new key at the provider.
- Overwrite the value in Cloud → Secrets.
- Invalidate the old key at the provider.
