Supabase has reached General Availability

Learn more
Edge Functions

Deploy JavaScript
globally in seconds

Easily author, deploy and monitor serverless functions distributed globally at the edge, close to your users.

globe wireframe

Fully managed

Edge Functions scale automatically, reducing your devops burden

Global deployments

Deploy worldwide for maximum resiliency and low latency

Secure and Scalable

Simply write your code in TypeScript and deploy

Node.js Support

Easily migrate existing workloads, with support for Node and more than 1 million NPM modules

Delightful DX from local to production

Edge Functions are developed using Deno, an open source JavaScript runtime that ensures maximum power and flexibility. Migrate in and out at any time with no vendor lock-in.

First-class local dev experience

Write code with hot code reloading, a fast Language server for autocompletion, type checking and linting

Dev
Prod

Dev and Prod parity

The open source Edge runtime runs your functions locally during development and the same runtime powers functions in production

fetchcryptoESLintatobmomentexpressfastifysocket.ioasynclodashunderscoreramdavalidatoryupday.jsdate-fnsjsonwebtokenbcryptuuidfs-extrarimrafmkdirpglobshelljs@supabase/supabase-jsjs-yamltypescriptjestwinstondebugeslintnodemondotenv@octokit/restcross-envcommanderyargsminimistchalkcolorsora@aws-sdkaxiospassportnodemailer@supabase/auth-helpers-reactmongooseopenaijwtreactmochaautoprefixer@supabase/auth-ui-reactgray-matterrequestprop-typesreact-dombluebirdvuetslibinquirerwebpackclassnamesbody-parserrxjsbabel-runtimejqueryfetchcryptoeslintatobmomentexpressfastifysocket.ioasynclodashunderscoreramdavalidatoryupday.jsdate-fnsjsonwebtokenbcryptminimistchalk

Use any NPM module

Tap into the 2+ million modules in the Deno and NPM ecosystem

jobs:
 deploy:
  runs-on: ubuntu-latest
 
  steps:
   - uses: actions/checkout@v3
   - uses: supabase/setup-cli@v1
   with:
    version: latest
   - run: supabase functions deploy

Continuous Integration

Use the Supabase CLI with Github actions to preview and deploy your functions along with the rest of your application

Edge Functions run server-side logic geographically close to users, offering low latency and great performance.

Global presence

Edge functions run globally or can be pinned to your database's proximity

Automatic scaling

Seamlessly scale with usage without any manual tuning

Secure

Scale with confidence with SSL, Firewall and DDOS protection built in

Built-in observability

Integrates seamlessly with the Supabase ecosystem

1const supabase = createClient(
2  Deno.env.get('SUPABASE_URL'),
3  Deno.env.get('SUPABASE_ANON_KEY')
4)
1const supabase = createClient(
2  Deno.env.get('SUPABASE_URL')!,
3  Deno.env.get('SUPABASE_ANON_KEY')!,
4  {
5    global: {
6      headers: {
7        Authorization:
8          req.headers.get('Authorization')!
9      }
10    }
11  }
12)
13
14const { data, error } = await supabase
15                                .from('countries')
16                                .select('*')
1create trigger "my_webhook" after insert
2on "public"."my_table" for each row
3execute function "supabase_functions"."http_request"(
4  'http://localhost:3000',
5  'POST',
6  '{"Content-Type":"application/json"}',
7  '{}',
8  '1000'
9);
1import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
2
3Deno.serve(async (req: Request) => {
4  // Create supabase client
5  const supabase = createClient(
6    Deno.env.get('SUPABASE_URL')!,
7    Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')!,
8    { global: {
9        headers: {
10          Authorization: req.headers.get('Authorization')!}
11        }
12    }
13  )
14
15  // Get the session or user object
16  const { data } = await supabase.auth.getUser()
17  const user = data.user
18})
1import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
2
3Deno.serve(async (req: Request) => {
4  // Create supabase client
5  const supabase = createClient(
6    Deno.env.get('SUPABASE_URL')!,
7    Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')!
8  )
9
10  // Upload image to storage
11  const { data, error } = await supabase.storage
12    .from('images')
13    .upload('filename.png', file, {
14      contentType: 'image/png',
15      cacheControl: '31536000',
16      upsert: false,
17    })
18}

We only collect analytics essential to ensuring smooth operation of our services. Learn more