Edge Functions

Create, edit, and delete Edge Functions directly from Supascale.

Self-hosted Supabase serves Edge Functions from a directory on the server, and Supabase Studio can only show what is already there — it cannot create or deploy new ones. Supascale fills that gap: every function is managed from the project's settings, and changes are live as soon as they are saved.

How functions are served

Each function is a directory with an index.ts entrypoint under supabase/docker/volumes/functions/ in the project directory. The functions container mounts that directory and routes /functions/v1/<name> to <name>/index.ts on every request, so:

  • A new directory is reachable immediately.
  • Saving a file takes effect on the next request.
  • Deleting a directory makes its URL return an error immediately.

No restart or deploy step is involved. The main directory is the runtime's own router — Supascale never lists, edits, or overwrites it.

Managing functions

Open Project → Settings → Edge Functions.

Create a function

  1. Click New function.
  2. Enter a name — lowercase letters, digits, - or _. It becomes the URL path, e.g. send-welcome-email/functions/v1/send-welcome-email.
  3. Click Create. A starter index.ts opens in the editor.

Edit a function

Click a function to open it. The left column lists its files; the editor shows the selected file.

  • Edit and click Save — the counter shows how many files have unsaved changes.
  • Add a file with the path box under the file list (lib/helper.ts creates the lib directory). It is written on the next Save.
  • Hover a file and click the trash icon to delete it. Deleting a file on disk is applied immediately.
  • The function's invoke URL is shown in the header with a copy button.

Files larger than 1 MB, and binary files, are listed but cannot be edited in the browser.

Delete a function

Click the trash icon next to a function in the list (or Delete in the editor) and confirm. This removes the whole directory. It cannot be undone unless you have a functions backup.

Import many functions at once

To bring in an existing supabase/functions directory, archive it and upload it from Backups & Migration → Import / Migrate, or use the import API:

tar -czf functions.tar.gz -C supabase functions

Functions in the archive replace any existing function of the same name; main/ is skipped.

Invoking a function

Functions go through the API gateway on the project's API port (or its custom domain), and expect a Supabase key:

curl "http://your-server:54321/functions/v1/send-welcome-email" \
  -H "Authorization: Bearer <anon or service_role key>" \
  -H "Content-Type: application/json" \
  -d '{"name": "Ada"}'

From a client:

const { data, error } = await supabase.functions.invoke('send-welcome-email', {
  body: { name: 'Ada' },
});

Service must be enabled. Functions are only served while the Edge Functions service is enabled under Settings → Services. The Edge Functions page warns you when it is off; you can still edit files in that state.

Secrets and environment

The runtime reads environment variables from the functions container. SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY, and SUPABASE_DB_URL are set for you. For other secrets, add them to the project's .env and reference them from the functions service in docker-compose.override.yml, then restart the project.

Backups

Function backups archive every function directory except main, and restores put them back where the runtime reads them. See Creating Backups.

API

Everything above is available over the API — see Edge Functions in the Projects API reference.