bpmn-web

中文文档
3.5.1发布于 2026/11/03TypeScriptES Module

bpmn-web Demo App

原始使用文档
文档目录8 节
  1. Installation
  2. Requirements
  3. Installation
  4. Usage
  5. Standalone
  6. Command line
  7. Model editor
  8. Embed the web adapter in an application

bpmn-web

HTTP integration and web UI for bpmn-server.

The reusable WebApp host is independent of any particular workflow application. An application supplies its own workflow definitions, configuration, persistence adapters and service implementations through a WorkflowApplication, usually through start(). The sample application, with its processes, connectors and delegates, and bpmn-web's tests are in testSampleApp/ at the repository root.

Installation

Requirements

  • Node.js >= 10.x
  • NPM >= 6.x
  • MongoDB >= 4.x

Installation

Setup .env with your mongodb connection string like so:

# PORT # for express application
PORT=3000

#API_KEY is used for remote access
API_KEY=12345
API_SERVICE_USER_NAME=integration
API_SERVICE_USER_GROUPS=SYSTEM
# Optional scope for a tenant service account:
# API_SERVICE_TENANT_ID=tenant-a
# API_SERVICE_MODELS_OWNER=tenant-a

# Separate credential for definition/model administration
ADMIN_API_KEY=replace-with-a-different-secret

# MongoDB Settings
MONGO_DB_URL=mongodb://0.0.0.0:27017/bpmn
#
... more settings

/api2 uses this configured service identity for every API-key request. The user object in a request body is ignored. Set the groups and optional tenant to the permissions the integration needs. The legacy /api routes remain a privileged API-key interface.

Install dependencies

git clone https://github.com/bpmnServer/bpmn-web.git

npm install

npm run setup

Usage

Standalone

npm start runs bpmn-web on its defaults: models in ./processes, the WebAppDelegate, no element templates. The sample application is started from the repository root (npm start) or testSampleApp/.

Command line

A console for the same server and database: start processes, list and invoke items, send messages and signals, list models and users, set a user's password (? lists the commands, q quits):

npm run cli

Commands can also be piped in, e.g. printf 'lo\nq\n' | npm run cli lists the outstanding items.

Model editor

The model editor is built from source in modeler/: bpmn-js with a properties panel that shows the settings bpmn-server runs (user assignment, who can start, service names, scripts on events, forms, inputs and outputs), and a Problems list: bpmn-server checks the model as it is edited (verifyModel), and an issue takes you to its element and field. npm start and npm run build build it into public/modeler/; while working on it, rebuild on change with:

npm run watch:modeler

modeler/PROPERTIES.md is the catalog of the panel's properties: by element, what each writes to the model file and what bpmn-server does with it when the process runs.

Testing models

The editor's Test tab keeps test scenarios for the model and runs them step by step. Start starts the process with the scenario's start data and shows the user tasks and events that wait as the next steps, each with its data and the instance page's button (Execute a user task, Force an event); running a step shows what waits next, until nothing waits. The data chooses the branches, and which step you run first chooses between elements that wait together (events of an event-based gateway, a boundary timer, parallel tasks). The steps you run are saved as the scenario's, so Run and Run all repeat them on a new instance without stopping, and check what the scenario expects at the end (status, data values, elements passed and not passed). Each scenario keeps its runs (the latest 20) with their instances, so its last run is shown when it is opened, and any earlier run can be opened again. Simulate plays a run on the diagram: an element turns blue when it starts and green when it ends (a joining gateway waits for its last branch), orange if it still waits; numbered in the order they started; Pause, Continue and Step while it plays. Test runs are ordinary instances whose ids start with test-.

Element templates

Configured tasks (a service task that calls a given service with its inputs, a user task for a given group) are element templates in the Camunda 7 template format, one or more per *.json file in the application's elementTemplatesPath (the sample's are in testSampleApp/connectors/). The editor offers them under Template in the properties panel.

A template is offered only if bpmn-server runs everything it sets: property bindings of the attributes the engine reads (the service name, user assignment, form key, decision, called process, script), input and output parameters, and JavaScript execution listeners. Templates that set anything else (Java classes, field injection, connectors, camunda:property, camunda:in/out) are left out, with the reason in the server log and in GET /model/templates. A template that names a service the application does not provide is offered, with a warning.

Models are designed by users in the DESIGNER group and by administrators (ADMIN, SYSTEM).

Set MODELER=classic to use the previous editor (the prebuilt modeller-withPropertyPanel.js) instead.

Embed the web adapter in an application

import { WebApp, defineWorkflowApplication } from 'bpmn-web';
import { configuration } from './workflow/configuration.js';

const workflowApplication = defineWorkflowApplication({ configuration });
const webApp = new WebApp(workflowApplication);

webApp.start();

Constructing WebApp composes the Express application and workflow runtime. Calling start() is explicit, so tests or a larger application can mount webApp.app without opening another listener.

版本与发布记录

bpmn-web 共发布 6 个版本,首次发布于 2026/11/01;过去 12 个月发布了 6 个版本。

版本发布日期距今
3.5.1latest2026/11/03今天
3.5.02026/11/03今天
3.1.02026/11/012 天前
3.0.32026/11/012 天前
3.0.12026/11/012 天前
0.0.0-stage2026/11/012 天前

关于 bpmn-web 的常见问题

bpmn-web 是什么?

bpmn-web演示应用

如何安装 bpmn-web?

在项目目录运行 npm install bpmn-web,或使用 pnpm add / yarn add / bun add。

bpmn-web 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

bpmn-web 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

bpmn-web 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

bpmn-web 可以商用吗?

bpmn-web 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

bpmn-web 还在维护吗?

最新版本 3.5.1 发布于 2026/11/03(今天);至今共发布 6 个版本,其中过去 12 个月发布了 6 个;首次发布于 2026/11/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。