Edge Functions
Run Deno TypeScript handlers — deploy from the dashboard, invoke with your project API key.
Deno.serve handlers
Deno.serve — the same shape as Supabase Edge Functions. Production isolates run on supabase/edge-runtime; local dev can use the Nest /api/fn runner (no Docker).Overview
Open a project → Edge Functions → Deploy a new function (or Open Editor). You get a FILES explorer (index.ts + optional extra files), Templates, and Deploy function. After deploy, open the function → Test to send a request from the sheet.
Only active (deployed) functions can be invoked. Save keeps draft source; Deploy promotes it.
Quickstart
Deno.serve(async (req) => {
if (req.method === 'OPTIONS') {
return new Response(null, {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, content-type, apikey',
},
})
}
const body = await req.json().catch(() => ({}))
return Response.json({
message: `Hello ${body.name ?? 'world'}`,
voltbaseUrl: Deno.env.get('VOLTBASE_URL') ?? null,
}, {
headers: { 'Access-Control-Allow-Origin': '*' },
})
})- Create a function in the dashboard (random name or your own, e.g.
hello-world). - Paste the handler (or pick a Template). Entry file must be
index.ts. - Click Deploy function, then Test → Send request.
Invoke from the SDK
Pass projectId (project UUID from API settings) and functionsUrl so voltbase.functions is enabled.
import { createClient } from 'voltbase-js'
const voltbase = createClient(projectUrl, anonKey, {
projectId: 'your-project-uuid',
// Local Nest runner:
functionsUrl: 'http://localhost:3000/api/fn',
// Or Docker edge-runtime / Railway:
// functionsUrl: 'http://localhost:9000',
})
const { data, error } = await voltbase.functions!.invoke('hello-world', {
body: { name: 'Voltbase' },
})Secrets & env
Set secrets under Edge Functions → Secrets (UPPER_SNAKE_CASE). They appear in Deno.env.get('KEY'). Built-ins:
VOLTBASE_URLVOLTBASE_ANON_KEYVOLTBASE_SERVICE_ROLE_KEYVOLTBASE_SCHEMA
Redeploy after changing secrets so new invokes pick them up.
Auth
Every invoke requires Authorization: Bearer <anon|service_role JWT>. The runtime verifies the token with PROJECT_JWT_SECRET and checks projectId matches the URL path /{projectId}/{functionName}.
Local runtime
Without Docker, point the web app and API at the Nest local runner:
# apps/api
FUNCTIONS_PUBLIC_URL=http://localhost:3000/api/fn
# apps/web
NEXT_PUBLIC_FUNCTIONS_URL=http://localhost:3000/api/fnFor isolated Deno workers (closer to production), run apps/functions with Docker and set FUNCTIONS_PUBLIC_URL=http://localhost:9000.