Supabase Edge Runtime: Self-hosted Deno Functions
Supabase Edge Runtime is an MIT-licensed, Rust-based web server built on deno_core that self-hosts Deno Edge Functions (TypeScript, JavaScript, WASM) without code changes. A hyper HTTP server forwards requests to a Main Worker V8 isolate, which can create sandboxed User Worker isolates with restricted APIs and configurable memory (default 150 MB) and wall-clock (default 60s) limits. It also powers `supabase functions serve` for serving all functions locally with hot reload and Deno Deploy API parity, and a Fly.io walkthrough shows how to deploy it. Planned uses include replacing Kong as an API gateway, scheduled functions, and custom platform globals.
Related posts
- Edge Functions are now available in Supabase
Supabase easyNoviceSupabase Edge Functions run TypeScript globally on the Deno runtime via Deno Deploy across 30+ data centers. Supabase chose functions-as-a-service over containers for simpler developer experience and faster start-ups, and global deployment over a single region, with Postgres-colocated Database Functions covering DB-heavy work. Requests pass through a Relay gateway that verifies JWTs, rate-limits and logs, then maps function metadata to a Deno Deploy deployment ID. Cold starts fetch code and secrets from Supabase, and logs flow through Logflare into the dashboard. Functions are POST-only, and static hosting is ruled out after phishing abuse on Supabase Storage got the domain denylisted.
- Edge Functions: Node and native npm compatibility
Supabase mediumAdeptSupabase Edge Functions now natively support npm modules (via `npm:` imports) and Node built-in APIs, so existing Node apps using Express, node-postgres and Drizzle can migrate with minimal changes. Under the hood, the open-source Deno-based Supabase Edge Runtime serializes each function's module graph into a single eszip at deploy time and loads all modules from it in the hosted, local and self-hosted environments alike. This avoids fetch latency, dependency conflicts with locally installed packages, and bugs such as failures when a deno.lock file is present. The release also adds regional invocation via an `x-region` header, CPU/memory and status-code metrics in the dashboard, and error tracking through Sentry's Deno SDK.
- Supabase Edge Functions: Introducing Background Tasks, Ephemeral Storage, and WebSockets
Supabase mediumAdeptSupabase Edge Functions gain background tasks, ephemeral /tmp file storage, and inbound/outbound WebSocket support. `EdgeRuntime.waitUntil` keeps a worker alive until a promise resolves, for up to 150 seconds on free plans and 400 seconds on paid plans, and a `beforeunload` event signals impending shutdown. A worked example shows that streaming zip extraction hits memory limits above roughly 100MB, and avoids this by writing the archive to /tmp and extracting it in a background task. A second example builds an authenticated relay to the OpenAI Realtime API, passing the Supabase JWT via query params because browser WebSocket clients can't send custom headers.
- Persistent Storage and 97% Faster Cold Starts for Edge Functions
Supabase mediumAdeptSupabase Edge Functions can now mount any S3-compatible bucket, including Supabase Storage, as a POSIX-like directory under /s3, configured through four S3FS_* environment secrets. One example reads a SQLite backup from S3 into memory and pushes aggregates to Postgres. Cold starts improved after workers still doing initial script evaluation were moved off the shared cooperatively scheduled Tokio thread pool onto a dedicated blocking pool, so heavy startup work no longer stalls neighbouring functions. In the benchmark, average boot time fell from 870 ms to 42 ms and P99 from 15 s to 460 ms. Synchronous file APIs are now allowed during initial script evaluation only, not inside request handlers or timers.
- Introducing @supabase/server
Supabase mediumAdept@supabase/server, now in public beta, replaces the repeated setup code found across 25,000 analyzed Edge Functions: client creation, JWT verification, claims parsing, CORS and auth wiring. A withSupabase wrapper (or createSupabaseContext for custom error handling) takes a declarative auth mode such as 'user', 'none', 'secret', 'publishable' or a combination. It rejects unauthorized requests before the handler runs and supplies a context with a user-scoped RLS client, a service-role admin client and verified claims. It handles the new asymmetric JWT signing keys and API keys internally, so migrating needs no jose or JWKS setup. It returns a standard Request-to-Response handler that runs on Edge Functions, Vercel, Cloudflare Workers, Bun and Hono, and exposes lower-level primitives for per-route auth.