Functions Server Reference

Self-Hosting Functions

A web server based on Deno runtime, capable of running JavaScript, TypeScript, and WASM services.

You can use it to:

  • Locally test and self-host Supabase's Edge Functions (or any Deno Edge Function)
  • As a programmable HTTP Proxy: You can intercept / route HTTP requests

How to run locally


_10
./run.sh start --main-service /path/to/supabase/functions -p 9000

using Docker:


_10
docker build -t edge-runtime .
_10
docker run -it --rm -p 9000:9000 -v /path/to/supabase/functions:/usr/services supabase/edge-runtime start --main-service /usr/services

How to update to a newer Deno version

Self hosting Edge Functions on Fly.io

We have put together a demo on how to self-host edge functions on Fly.io (you can also use other providers like Digital Ocean or AWS).

To try it yourself,

  1. Sign up for an Fly.io account and install flyctl
  2. Clone the demo repository to your machine - https://github.com/supabase/self-hosted-edge-functions-demo
  3. Copy your Edge Function into the ./functions directory in the demo repo.
  4. Update the Dockerfile to pull the latest edge-runtime image (check releases)
  5. [Optional] Edit ./functions/main/index.ts, adding any other request preprocessing logic (for example, you can enable JWT validation, handle CORS requests)
  6. Run fly launch to create a new app to serve your Edge Functions
  7. Access your Edge Function by visiting: https://{your-app-name}.fly.dev/{your-function-name}

You can view the logs for the Edge Runtime, by visiting Fly.io’s Dashboard > Your App > Metrics. Also, you can serve edge-runtime from multiple regions by running fly regions add [REGION].

Client libraries