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

推荐订阅源

L
LangChain Blog
V
V2EX
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
小众软件
小众软件
Vercel News
Vercel News
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
J
Java Code Geeks
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
B
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.