Cloud
Functions
Serverless TypeScript functions with access to the database, AI, secrets, and external HTTP. You call it from the app with a single line.
Creating a function
In Cloud → Functions, enter a name and choose a template. The editor will open, and you save the code with the Save button.
ctx API
ts
async function handler(ctx) {
// ctx.input, ctx.user, ctx.log()
const rows = await ctx.db.list("posts");
const text = await ctx.ai.text("Write a greeting");
const key = await ctx.secrets.get("STRIPE_KEY");
const res = await ctx.fetch("https://api.example.com/x");
return { ok: true, text };
}Calling from the app
js
const result = await vibe.fn("send-email").invoke({
to: "user@example.com",
subject: "Welcome!"
});The function is saved automatically before running.
Limity
- Max execution time: 15 s
- Outbound fetch timeout: 10 s
- Max body 10 MB
