bpmn-server

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

BPMN 2.0 Server including Modeling, Execution and Persistence, an open source for Node.js

原始使用文档
文档目录25 节
  1. Architecture Overview
  2. Quick Start
  3. Using the Demo Project
  4. Programmatic Usage Example
  5. Modeling
  6. Execution
  7. Datastore
  8. User Management and Security
  9. Demo Web Application
  10. Live Demo
  11. Installation
  12. 1. Clone the repository
  13. 2. Install dependencies
  14. 3. Set up the app
  15. 4. Start the server
  16. Docker Installation
  17. 1. Create a project folder
  18. 2. Add a docker-compose.yml file:
  19. 3. Start the container
  20. Command Line Interface
  21. Updating to Latest Release
  22. Application Integration
  23. Documentation
  24. License
  25. Acknowledgments

Overview Home

bpmn-server is a BPMN-based workflow engine that integrates easily into your Node.js app. It supports built-in state persistence, variable management, and concurrency across clusters—ideal for long-running processes, durable services, and scheduled tasks.

Architecture Overview

The following diagram illustrates the core components of bpmn-server and how they interact:

Architecture Diagram

  • Modeler: Front-end UI for designing BPMN models using bpmn.io.
  • bpmn-server Core: Executes BPMN workflows, manages state, and interfaces with external services.
  • Datastore: Persists workflow state, variables, and history (MongoDB by default).
  • Application Layer: Your Node.js app that integrates with the server, handles user authentication, and invokes workflows.

Quick Start

Using the Demo Project

# 1. Clone the demo app
$ git clone https://github.com/bpmnServer/bpmn-web.git
$ cd bpmn-web

# 2. Install dependencies
$ npm install

# 3. Run setup to create default install files
$ npm run setup

# 4. Edit `.env` file.

# 5. Run setup to create database and models
$ npm run setup

# 6. Start the server
$ npm run start

Open your browser to http://localhost:3000 to launch the demo.

Programmatic Usage Example

const { BPMNServer, DefaultAppDelegate } = require('bpmn-server');
const { configuration } = require('./configuration');

const server = new BPMNServer(configuration, new DefaultAppDelegate());

const processName = 'invoice';
const inputData = { amount: 1200 };

(async () => {
    const result = await server.engine.start(processName, inputData);
    console.log('Process started with instance id:', result.instance.id);
})();

For more advanced examples, see the API documentation.


Modeling

bpmn-server provides a modeling tool based on bpmn.io with a customized property panel, eliminating the need to manually edit BPMN files.

You can also import BPMN models from other tools.

Each model is defined in a BPMN XML file and consists of various elements. An element can be a node (such as events, tasks, or gateways) or a flow.

Models are managed by bpmn-server and can be queried using the Model API.

All BPMN 2.0 elements are supported. See Modeling Support

Execution

bpmn-server is primarily an execution engine for BPMN models.

Each time a model is started, an instance is created. For every element that is executed, an item is generated.

Execution follows the BPMN model logic and supports extensions such as scripting and application context access.

During execution, both Model Listeners and Application Listeners are invoked.

Access the execution engine via the Engine API.

Datastore

Execution data, including instances and their elements, are persisted to a datastore (MongoDB by default).

You can query this data through the Data API.

User Management and Security

bpmn-server delegates authentication to the front-end application, which must pass user information via the API.

  1. Model designers can define assignee, candidateUsers, and candidateUserGroups using static strings or JavaScript expressions.
  2. The front-end must provide a userService implementation.
  3. bpmn-server enforces security rules based on the current user.

The bpmn-web demo application demonstrates full user management using Passport and MongoDB.

Demo Web Application

Explore the `bpmn-web` demo application.

Features include:

  • Persistent modeling tool (based on bpmn.io)
  • Property panel supporting all bpmn-server features
  • Execution with input forms for defined fields

  • Task and workflow lists
  • Instance detail view

  • Model specification viewer

Live Demo

A live demo is available at: https://bpmn.omniworkflow.com

Installation

This package requires Node.js and MongoDB.

If MongoDB is not installed, you can create a free cloud account or install it locally.

1. Clone the repository

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

2. Install dependencies

npm install

3. Set up the app

npm run setup

Edit the .env file to configure MongoDB:

MONGO_DB_URL=mongodb://0.0.0.0:27017/bpmn

Run setup again to create DB objects:

npm run setup

4. Start the server

npm run start

Console output:

bpmn-server WebApp.ts version 1.4.0
MongoDB URL mongodb://0.0.0.0:27017/bpmn
db connection open
App is running at http://localhost:3000 in development mode
Press CTRL-C to stop

Docker Installation

Install `bpmn-server` and dependencies with Docker.

1. Create a project folder

2. Add a docker-compose.yml file:

version: "3.7"
name: bpmn-server
services:
  bpmn-web:
    image: ralphhanna/bpmn-web
    command: sh -c "
        npm run setup &&
        npm run start"
    ports:
      - 3000:3000
    volumes:
      - 'app:/app'
    depends_on:
      - mongo

  mongo:
    image: mongo
    ports:
      - 27017:27017
    volumes:
      - mongodb:/data/db

volumes:
  mongodb:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: './mongodb_volume'

  app:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: './bpmn_server_volume'

3. Start the container

docker compose up -d

Command Line Interface

Use `bpmn-server` via CLI for common operations.
npm run cli

server started..
Commands:
  q     quit
  s     start process
  lo    list outstanding items
  li    list items
  l     list instances for a process
  di    display instance information
  i     invoke task
  sgl   signal task
  msg   message task
  d     delete instances
  lm    list models
  lme   list model elements
  ck    check locked instances
  re    recover hung processes
  lu    list users
  spw   set user password
  ?     show this help menu

Updating to Latest Release

npm update bpmn-server

Application Integration

bpmn-server is designed to be embedded into your application. See customization guide

Documentation

License

Licensed under the MIT License.

Acknowledgments

bpmn-server builds upon bpmn-io/bpmn-moddle by bpmn.io, and is inspired by bpmn-engine.

版本与发布记录

bpmn-server 共发布 114 个版本,首次发布于 2020/06/04;过去 12 个月发布了 9 个版本。

版本发布日期距今
3.5.1latest2026/11/03今天
3.5.02026/11/03今天
3.2.02026/10/295 天前
3.1.02026/10/2311 天前
3.0.32026/09/261 个月前
3.0.12026/07/083 个月前

其他发布通道:alpha → 2.0.10-alpha4。

关于 bpmn-server 的常见问题

bpmn-server 是什么?

BPMN 2.0服务器,包括建模、执行和持久化,一个开源的Node.js

如何安装 bpmn-server?

在项目目录运行 npm install bpmn-server,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 bpmn-server,可以用 npx bpmn-server 直接运行。

bpmn-server 支持 TypeScript 吗?

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

bpmn-server 支持 ESM 还是 CommonJS?

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

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

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

bpmn-server 可以商用吗?

bpmn-server 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

bpmn-server 还在维护吗?

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