Skip to main content
A workflow is one file in an app’s src/api/ directory that default-exports createEndpoint from zitejs/backend — server-side logic with typed inputs and outputs.
Each workflow must be a default export, and the filename is the workflow id — a single segment matching ^[a-zA-Z0-9_-]+$ (no subfolders under src/api/).

Config

Context

execute receives a context: process.env.ZITE_APP_URL is set to your app’s public URL — use it to build links instead of hardcoding.

Errors

Throw ZiteError to return a controlled error with an HTTP status:

Calling workflows from the frontend

Workflows are called through a generated, typed client (like tRPC). Each workflow exports a camel-cased caller plus its input/output types:
After adding, renaming, or deleting a workflow file, regenerate the client with npx zitejs generate from the workspace root (the build tools do this for you). Workflows are also reachable publicly at POST /public/{flowId}/api/{name}.

Streaming

Set stream: true and write chunks as you go:
On the frontend, streaming workflows are called with the generated streaming caller, which yields chunks and resolves a final result.