Configure Next.js
Wrap your Next.js config with The
withWorkflow() to enable the "use workflow" and "use step" directives:next.config.ts
withWorkflow function configures both Turbopack and Webpack loaders to transform workflow and step functions.Configuration Options
You can pass options towithWorkflow:next.config.ts
Update middleware (if applicable)
If your Next.js app uses middleware, exclude Workflow’s internal paths:
middleware.ts
How it works
The Next.js integration:- Configures Turbopack and Webpack loaders to transform workflow files
- Discovers workflows from
pages/,app/,src/pages/, andsrc/app/directories - Generates route handlers at
.well-known/workflow/v1/*endpoints - Uses deferred entries in Next.js 16.1+ for optimized builds
- Automatically configures local storage in development
- Integrates with Vercel’s infrastructure in production
Example workflow
workflows/user-signup.ts
Triggering workflows
Start workflows from API routes or Server Actions:app/api/signup/route.ts
Next steps
Core Concepts
Learn about workflows and steps
API Reference
View the full Next.js API reference