Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Supabase 3 min read Announcement mediumAdept

Edge Functions: Node and native npm compatibility

Supabase 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.

Assumes: Deno basicsnpm modules

Related posts

  • Edge Functions are now available in Supabase

    Supabase easyNovice

    Supabase 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 are now 2x smaller and boot 3x faster

    Supabase mediumAdept

    Supabase Edge Functions that use npm modules now bundle roughly half as large and boot several times faster. Example boot times drop from 275ms to 25ms for supabase-js and from 459ms to 57ms for the OpenAI SDK. The gains come from three changes to eszip handling in Edge Runtime: per-entry SHA-256 integrity checks now run lazily when a module is actually loaded, npm package bytes are serialized with rkyv instead of JSON number arrays that doubled their size, and source checksums switched from SHA-256 to the non-cryptographic xxHash-3. Redeploying with a recent Supabase CLI picks up the improvements.

  • Supabase Edge Runtime: Self-hosted Deno Functions

    Supabase mediumAdept

    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.

  • Executing Dynamic JavaScript Code on Supabase with Edge Functions

    Supabase mediumAdept

    Supabase Edge Functions can execute arbitrary JavaScript sent in the request body by wrapping it in an async `new Function()` that receives a preconfigured service-role Supabase client, so business logic can change without redeploying. SQL helpers built on the pgsql-http extension let Postgres call the function directly. `edge.http_request` wraps the HTTP call, `edge.edge_wrapper` adds retries with backoff delays and rotation across allowed regions via an `x-region` header, `edge.get_secret` reads the service-role key from Vault, and `edge.exec` ties them together. Access is limited to callers presenting the service_role key, since the function would otherwise be an open remote code execution endpoint.

  • 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.

The quest for software engineering knowledge.

Look:
Layout: