Run TypeScript or JavaScript on the server, next to your database: webhooks, payments, emails, AI calls and anything that needs a secret.
Quickstart
Create, deploy and call your first function.
Write functions
Requests, responses, imports and files.
Environment and secrets
Built-in variables and your own secrets.
Call functions
From the SDK, curl, other services or SQL.
Middleware
The signed-in user, rate limits and errors as JSON, in a few lines.
Examples
Webhooks, emails, AI, database access.
Limits
Memory, CPU, time and invocations per plan.
#How they work
Each function is served at https://<project-ref>.p.stitchdb.com/functions/v1/<name> and runs on the same server as your project, in its own isolate with your project's environment variables and secrets. Functions use the Deno runtime APIs: Deno.serve, fetch, Request/Response, Web Crypto, streams, plus packages from npm and JSR.
- Authenticated by default. Callers send your anon key, the service role key or a signed-in user's token; you can turn this off per function (for webhooks). See Authentication.
- CORS is handled for you: browser apps can call functions from any origin. See CORS.
- Versioned. Every deploy with changed code is a new version; roll back with one click.
- Observable. Console output, errors, invocations and response times are in Studio. See Logs and monitoring.
#Manage them
Studio → Edge Functions lists your functions and lets you create one from a template, edit and deploy code, send test requests, read logs, change settings and manage secrets. Everything is also available through the management API with an access token.