WorkflowController

NestJS controller that serves the workflow runtime routes.

NestJS controller that handles the well-known workflow endpoints under .well-known/workflow/v1. It dynamically imports the generated workflow bundles and converts between Express/Fastify requests and the Web API Request/Response objects the workflow runtime expects. Both the Express and Fastify HTTP adapters are supported.

WorkflowModule.forRoot() registers this controller automatically. You only register it yourself if you are not using WorkflowModule.

Usage

When registering the controller manually, call configureWorkflowController first so it can locate the generated bundles; its route handlers throw otherwise.

src/app.module.ts
import { join } from "node:path";
import { Module } from "@nestjs/common";
import {
  configureWorkflowController,
  WorkflowController,
} from "workflow/nest";

configureWorkflowController(join(process.cwd(), ".nestjs/workflow"));

@Module({
  controllers: [WorkflowController],
})
export class AppModule {}

Routes

RouteMethodDescription
/.well-known/workflow/v1/flowPOSTExecutes workflow and step work items via the combined handler in workflows.mjs (step registrations are imported from steps.mjs first).
/.well-known/workflow/v1/webhook/:tokenAnyForwards webhook requests to the handler in webhook.mjs.
/.well-known/workflow/v1/manifest.jsonGETServes the workflow manifest. Responds with 404 unless the WORKFLOW_PUBLIC_MANIFEST=1 environment variable is set.