Skip to content

Supabase Edge Functions

Supabase is an open-source alternative to Firebase, offering a suite of tools similar to Firebase's capabilities, including database, authentication, storage, and now, serverless functions.

Supabase Edge Functions are server-side TypeScript functions that are distributed globally, running closer to your users for improved performance. These functions are developed using Deno, which brings several benefits, including improved security and a modern JavaScript/TypeScript runtime.

Here's how you can get started with Supabase Edge Functions:

1. Setup


Before you begin, make sure you have the Supabase CLI installed. If you haven't installed it yet, follow the instructions in the official documentation.

Creating a New Project

  1. Open your terminal or command prompt.

  2. Create a new Supabase project in a directory on your local machine by running:

supabase init

This command initializes a new Supabase project in the current directory.

Adding an Edge Function

  1. Inside your Supabase project, create a new Edge Function named hello-world:
supabase functions new hello-world

This command creates a new Edge Function with the specified name in your project.

2. Hello World

Edit the hello-world function by modifying the file supabase/functions/hello-world/index.ts:

import { Hono } from ''
import type { Context } from ''

// change this to your function name
const functionName = 'hello-world'
const app = new Hono().basePath(`/${functionName}`)

app.get('/hello', (c: Context) => c.text('Hello from hono-server!'))


3. Run

To run the function locally, use the following command:

  1. Use the following command to serve the function:
supabase start # start the supabase stack
supabase functions serve --no-verify-jwt # start the Functions watcher

The --no-verify-jwt flag allows you to bypass JWT verification during local development.

  1. Make a GET request using cURL or Postman to
curl  --location  ''

This request should return the text "Hello from hono-server!".

4. Deploy

You can deploy all of your Edge Functions in Supabase with a single command:

supabase functions deploy

Alternatively, you can deploy individual Edge Functions by specifying the name of the function in the deploy command:

supabase functions deploy hello-world

For more deployment methods, visit the Supabase documentation on Deploying to Production.

Released under the MIT License.