Skip to main content
Sign In
Platforms

Deploying to Supabase Functions

Run RivetKit on Supabase Edge Functions with the WebAssembly runtime.

Supabase Edge Functions run RivetKit through the WebAssembly runtime. Use the public @rivetkit/rivetkit-wasm package, load the wasm file with Deno, and use remote SQLite.

Steps

Prerequisites

Create the Function

npx supabase functions new rivet

Add the packages used by the function:

npm install rivetkit @rivetkit/rivetkit-wasm

Configure the Function

Supabase Functions run under Deno, so load the wasm bytes from the package export and pass them to setup({ wasm }).

Set Secrets

Set the Rivet connection values as Supabase secrets. The pool name must match the serverless runner configured in Rivet.

npx supabase secrets set \
  RIVET_ENDPOINT=https://api.rivet.dev \
  RIVET_PUBLIC_ENDPOINT=https://your-namespace:pk_...@api.rivet.dev \
  RIVET_NAMESPACE=your-namespace \
  RIVET_POOL=supabase-functions \
  RIVET_TOKEN=sk_...

Deploy

npx supabase functions deploy rivet

After deploy, set the function URL with the /api/rivet path as the serverless runner URL in Rivet. For a function named rivet, this is usually https://your-project.functions.supabase.co/functions/v1/rivet/api/rivet.

Runtime Notes

  • Use runtime: "wasm" in setup(...) for Supabase Functions. You can also set RIVETKIT_RUNTIME=wasm in environments where the registry config does not set runtime.
  • Pass wasm: { bindings, initInput } explicitly from @rivetkit/rivetkit-wasm.
  • Use remote SQLite on Supabase Functions. Leaving SQLite unset with runtime: "wasm" selects remote SQLite automatically.
  • Keep RIVET_PUBLIC_ENDPOINT pointed at the client-facing Rivet endpoint. Register the function URL separately as the serverless runner URL.
  • Supabase Functions run in Deno, so load the wasm module with Deno-friendly bytes, URL, response, or module input.