Skip to main content
This guide shows you how to install Workflow DevKit in a Next.js project.
1

Install dependencies

Install the workflow package:
2

Configure Next.js

Wrap your Next.js config with withWorkflow() to enable the "use workflow" and "use step" directives:
next.config.ts
The withWorkflow function configures both Turbopack and Webpack loaders to transform workflow and step functions.

Configuration Options

You can pass options to withWorkflow:
next.config.ts
3

Update middleware (if applicable)

If your Next.js app uses middleware, exclude Workflow’s internal paths:
middleware.ts
4

Enable TypeScript support (Optional)

Add the Workflow TypeScript plugin to your tsconfig.json for IntelliSense:
tsconfig.json

How it works

The Next.js integration:
  • Configures Turbopack and Webpack loaders to transform workflow files
  • Discovers workflows from pages/, app/, src/pages/, and src/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