Configure Nitro
Add the Workflow module to your Nitro config:The Workflow module automatically:
nitro.config.ts
- Adds the Rollup transform plugin to process workflow directives
- Builds workflow bundles during development and production
- Generates route handlers at
.well-known/workflow/v1/* - Supports hot module replacement in development
Configuration Options
You can configure the TypeScript plugin:nitro.config.ts
How it works
The Nitro integration:- Transform plugin: Uses
@workflow/rollupto transform workflow and step functions - Build hooks: Builds workflows during
build:beforeand supports HMR viadev:reload - Route generation: Creates virtual handlers for workflow endpoints:
/.well-known/workflow/v1/webhook/:token- Webhook handling/.well-known/workflow/v1/step- Step execution/.well-known/workflow/v1/flow- Workflow execution/.well-known/workflow/v1/manifest.json- Manifest (whenWORKFLOW_PUBLIC_MANIFEST=1)
- Vercel integration: Automatically generates Vercel functions when deploying with
preset: 'vercel' - Externalization: Excludes generated workflow bundles from dev reloads for better performance
Example workflow
server/workflows/order-processing.ts
Triggering workflows
Start workflows from API routes:server/api/orders.post.ts
Development
Run the development server:- Build workflows on startup
- Watch for changes and rebuild automatically
- Provide HMR for workflow files
Production
Build for production:- Generates Vercel function configurations
- Sets up queue triggers for workflow execution
- Configures retry policies
Advanced usage
Exposing the manifest
Set theWORKFLOW_PUBLIC_MANIFEST environment variable to expose the workflow manifest:
/.well-known/workflow/v1/manifest.json.
Using with other frameworks
The Nitro integration is used internally by:- Express: Via custom routes configuration
- Fastify: Via custom routes configuration
- Hono: Via custom routes configuration
- Nuxt: Via the Nuxt module which wraps Nitro
Next steps
Core Concepts
Learn about workflows and steps
API Reference
View the full Nitro API reference