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
ThrowZiteError 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: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
Setstream: true and write chunks as you go:
result.