Skip to content

API functions

  • 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.
  • 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.
  • 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.