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

nitro.config.ts
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 /_workflow in development.
  • Configures Vercel function rules (queue triggers and maxDuration) for the workflow routes when deploying to Vercel.
  • Uses Nitro's workspaceDir as 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:

nitro.config.ts
import { defineConfig } from "nitro";
import type { ModuleOptions } from "workflow/nitro"; 

const workflow: ModuleOptions = {
  runtime: "nodejs22.x",
};

export default defineConfig({
  modules: ["workflow/nitro"],
  workflow, 
});
OptionTypeDefaultDescription
dirsstring[]Directories to scan for workflows and steps. By default, the workflows/ directory is scanned from the project root and all layer source directories.
typescriptPluginbooleanfalseAdds the workflow TypeScript plugin to the generated tsconfig.json for IDE IntelliSense.
runtimestringNode.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.

On this page

Edit this page on GitHub