Edge FunctionsGuidesOverview

Edge Functions

Globally distributed TypeScript functions.

Edge Functions are server-side TypeScript functions, distributed globally at the edge—close to your users. They can be used for listening to webhooks or integrating your ExtraBase project with third-parties like Stripe. Edge Functions are developed using Deno, which offers a few benefits to you as a developer:

  • It is open source.
  • It is portable. ExtraBase Edge Functions run locally, and on any other Deno-compatible platform (including self-hosted infrastructure).
  • It is TypeScript first and supports WASM natively.
  • Edge Functions are globally distributed for ultra low-latency.

How it works

Request enters an edge gateway (relay) — the gateway routes traffic, handles auth headers/JWT validation, and applies routing/traffic rules.
Auth & policies are applied — the gateway (or your function) can validate ExtraBase JWTs, apply rate-limits, and centralize security checks before executing code.
Edge runtime executes your function — the function runs on a regionally-distributed Edge Runtime node closest to the user for minimal latency.
Integrations & data access — functions commonly call ExtraBase APIs (Auth, Postgres, Storage) or third-party APIs.
Observability and logs — invocations emit logs and metrics you can explore in the dashboard or downstream monitoring.
Response returns via the gateway — the gateway forwards the response back to the client and records request metadata.

Quick technical notes

Runtime: ExtraBase Edge Runtime (Deno compatible runtime with TypeScript first). Functions are simple `.ts` files that export a handler.
Local dev parity: Use ExtraBase CLI for a local runtime similar to production for faster iteration (`extrabase functions serve` command).
Global deployment: Deploy your Edge Functions via ExtraBase Dashboard, CLI, or Git actions.

Live Playground: Invoke Serverless functions

Interact directly with the Deno Deploy Sandbox below. Toggle templates and execute Deno isolates.

Deno Deploy Sandbox
import { serve } from "https://deno.land/std/http/server.ts"

serve(async (req) => {
  const { name } = await req.json()
  return new Response(JSON.stringify({ 
    message: "Hello " + (name || "Developer") + "!",
    ts: Date.now()
  }), { 
    headers: { "Content-Type": "application/json" } 
  })
})
Execution Output Console
Waiting for deployment trigger...