Skip to content
- API functions: Each file in
functions/ becomes an endpoint for signed-in callers, reloaded while you work.
- Records as the caller: Functions read and write records with the caller’s access, validation and hooks.
- Input checks: Request bodies are checked with zod, Valibot or another Standard Schema validator.
- Roles for functions: A function can be limited to roles or a capability; in an app with roles, one with neither is open only to roles that hold everything.
- Public functions and webhooks: A function can be open to anyone, with helpers that check webhook signatures.
- WebSockets: A function can accept a WebSocket, and the caller is checked again every minute.
- TCP bridges (beta): A signed-in user’s page reaches a TCP service on the app’s private network, such as a server’s console or a database, over a WebSocket, as an access rule the app writes allows, without a VPN client; a bridge token opens once, on any instance serving the app.
- Calling a function: The typed client’s
invoke calls a function with the signed-in user’s token, from an action or any page.
- Work after the response: A function can answer at once and finish its work afterwards, which a graceful stop waits for.
- Hono apps: A function with several routes can be a Hono app.
- The organization’s tables (beta): With organizations on, the
db of functions, jobs and hooks, and sign-in’s own queries, read and write the memberships, invitations and personal access tokens of one organization only, the caller’s, and with organizations off after being on, the default organization’s, unless the code opts out with db.unscoped('<reason>'); raw SQL names those tables through scoped() or unscoped().
- Transactions:
db.transaction([...]) sends query builders as one all-or-nothing transaction in one round trip, with a result per query.
- Long queries: A function or job that does bulk work may run queries for up to 30 seconds, on a connection kept for it, and functions and jobs always leave a connection to page requests.