惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
J
Java Code Geeks
G
Google Developers Blog
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Vercel News
Vercel News
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
Y
Y Combinator Blog
博客园_首页
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
A
About on SuperTechFans
B
Blog
Microsoft Security Blog
Microsoft Security Blog

Workflow SDK Documentation

Patterns for Defining Tools Human-in-the-Loop Building Durable AI Agents Queueing User Messages Resumable Streams Sleep, Suspense, and Scheduling Streaming Updates from Tools API Reference Workflow Globals Changelog Resilient run start Cookbook Building a World Deploying Astro Express Fastify Hono Getting Started NestJS Next.js Nitro Nuxt Python SvelteKit Vite corrupted-event-log fetch-in-workflow hook-conflict Errors
WorkflowModule
2026-06-12 · via Workflow SDK Documentation

NestJS module that builds workflow bundles and registers the workflow controller.

NestJS module that provides workflow functionality. It builds the workflow bundles on module initialization (onModuleInit) and registers the WorkflowController that serves the workflow runtime routes.

Add WorkflowModule.forRoot() to the imports array of your root module.

import { Module } from "@nestjs/common";
import { WorkflowModule } from "workflow/nest"; 

@Module({
  imports: [WorkflowModule.forRoot()], 
})
export class AppModule {}

If your NestJS project compiles to CommonJS via SWC, pass moduleType and distDir so the builder can rewrite imports in the generated bundles:

import { Module } from "@nestjs/common";
import { WorkflowModule } from "workflow/nest";

@Module({
  imports: [
    WorkflowModule.forRoot({
      moduleType: "commonjs", 
      distDir: "dist", 
    }),
  ],
})
export class AppModule {}

Static Methods

forRoot(options?)

Configures the module and returns a NestJS DynamicModule registered as global. It calls configureWorkflowController with the resolved output directory, and (unless skipBuild is set) creates a NestLocalBuilder that builds the workflow bundles when the module initializes.

Parameters

ParameterTypeDescription
optionsWorkflowModuleOptionsOptional. Configures the workflow build.

WorkflowModuleOptions

Extends NestBuilderOptions — all builder options are accepted, plus skipBuild:

OptionTypeDefaultDescription
skipBuildbooleanfalseSkip building workflow bundles on startup. Useful in production when the bundles are pre-built.
workingDirstringprocess.cwd()Working directory for the NestJS application.
dirsstring[]['src']Directories to scan for workflow files.
outDirstring'.nestjs/workflow' (relative to workingDir)Output directory for generated workflow bundles.
watchbooleanfalseEnable watch mode for development.
moduleType'es6' | 'commonjs''es6'SWC module compilation type. Set to 'commonjs' if your NestJS project compiles to CJS via SWC.
distDirstring'dist'Directory where NestJS compiles .ts source files to .js (relative to workingDir). Used when moduleType is 'commonjs'. Should match the outDir in your tsconfig.json.

Returns

forRoot() returns a DynamicModule to include in the imports array of your root module.