serverless-functions
serverless-functionsdev
Serverless Functions
Deploy a TypeScript function in one API call. Invoke it in milliseconds. Self-hosted, runs on your infrastructure.
# Deploy
curl -X POST /deploy -d '{"id":"hello","code":"function handler(data) { return { message: \"Hello \" + data.name } }"}'
# Invoke
curl -X POST /invoke/hello -d '{"name":"World"}'
→ { "message": "Hello World" }
What You Can Build
- Custom APIs — lightweight HTTP handlers without a full backend
- Webhooks — receive and process events from Stripe, GitHub, Slack
- Data transforms — reshape data on the fly
- AI pipelines — call Claude, GPT, or Ollama with custom prompts
- Provisioning hooks — run scripts before/after database lifecycle events
- Scheduled tasks — trigger functions on a cron schedule
How It Works
You write a handler function. It receives data, returns a result:
function handler(data) {
return { greeting: "Hello, " + data.name };
}
Async is supported — use fetch to call any API:
async function handler(username) {
const res = await fetch("https://api.github.com/users/" + username);
const user = await res.json();
return { name: user.name, repos: user.public_repos };
}
Functions deploy in ~10ms and invoke in ~1-5ms. Each runs in its own isolated sandbox with network access only — no filesystem, no environment variables.
Provisioning Hooks
Edge functions integrate with K8s Provisioning as lifecycle hooks. Attach a function to run before or after database events:
| Hook | When |
|---|---|
post-provision | After a database is ready — seed data, notify Slack, install extensions |
pre-deprovision | Before deletion — create final backup, audit log |
post-backup | After backup completes — notify ops channel |
Hooks are non-blocking. If a function fails, provisioning continues normally.
Get Started
See the Quick Start — deploy your first function in 30 seconds.