workflow/nitro
Nitro module for automatic workflow bundling and route registration.
Nitro integration for Workflow SDK. The workflow/nitro entry point's default export is a Nitro module — it has no callable API. You enable it by adding it to the modules array of your Nitro config and configure it via the workflow key.
Usage
import { defineConfig } from "nitro";
export default defineConfig({
serverDir: "./server",
modules: ["workflow/nitro"],
});When enabled, the module:
- Transforms
"use workflow"and"use step"directives during bundling. - Builds the workflow, step, and webhook bundles, and rebuilds them on file changes in development.
- Registers the workflow runtime routes under
/.well-known/workflow/v1/. - Serves a redirect to the local observability dashboard at
/_workflowin development. - Configures Vercel function rules (queue triggers and
maxDuration) for the workflow routes when deploying to Vercel. - Uses Nitro's
workspaceDiras the workflow project root so monorepo apps can import sibling workspace packages without extra workflow config.
Module Options
Options are read from the workflow key of your Nitro config. The option type is exported as ModuleOptions:
import { defineConfig } from "nitro";
import type { ModuleOptions } from "workflow/nitro";
const workflow: ModuleOptions = {
runtime: "nodejs22.x",
};
export default defineConfig({
modules: ["workflow/nitro"],
workflow,
});| Option | Type | Default | Description |
|---|---|---|---|
dirs | string[] | — | Directories to scan for workflows and steps. By default, the workflows/ directory is scanned from the project root and all layer source directories. |
typescriptPlugin | boolean | false | Adds the workflow TypeScript plugin to the generated tsconfig.json for IDE IntelliSense. |
runtime | string | — | Node.js runtime version for Vercel Functions (e.g. 'nodejs22.x', 'nodejs24.x'). Only applies when deploying to Vercel. |
Vite-based Nitro
If you use Nitro through its Vite plugin (nitro/vite) instead of a standalone nitro.config.ts, use the workflow/vite entry point, which wraps this module as a Vite plugin and accepts the same ModuleOptions.