Every function gets its project's URL and keys, plus the secrets you add.
#Built-in variables
| Variable | Value |
|---|---|
STITCHDB_URL | Your project URL, https://<project-ref>.p.stitchdb.com |
STITCHDB_ANON_KEY | The public anon key |
STITCHDB_SERVICE_ROLE_KEY | The service role key (bypasses Row Level Security) |
STITCHDB_DB_URL | A Postgres connection string for the transaction pooler (port 6543), as the project owner, TLS required |
STITCHDB_PROJECT_REF | The project reference |
STITCHDB_FUNCTION_SLUG | The name of the running function |
#Your secrets
Studio → Edge Functions → Secrets → Add secrets takes one NAME=value per line, like a .env file. Secrets are shared by every function of the project, stored encrypted, and never shown again: the list shows each name with a SHA-256 digest of its value so you can check which value is set. Read them with Deno.env.get():
TypeScript
const url = Deno.env.get('STITCHDB_URL')!
const stripeKey = Deno.env.get('STRIPE_SECRET_KEY')
if (!stripeKey) return new Response('STRIPE_SECRET_KEY is not set', { status: 500 })Names use letters, digits and _ and don't start with a digit. Names starting with STITCHDB_ are reserved. Up to 100 secrets per project, 64 KB each. Changes apply from the next request; no redeploy is needed.
#With the API
Terminal
curl -X POST 'https://stitchdb.com/platform/v1/projects/<project-ref>/secrets' \
-H "Authorization: Bearer $STITCHDB_TOKEN" \
-H 'Content-Type: application/json' \
-d '[{ "name": "STRIPE_SECRET_KEY", "value": "sk_live_..." }]'GET on the same URL lists names and digests; DELETE with a JSON array of names removes them.