Convert Figma logo to code with AI

bpmn-io logobpmn-js

A BPMN 2.0 rendering toolkit and web modeler.

8,494
1,305
8,494
135

Top Related Projects

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.

A compact and highly efficient workflow and Business Process Management (BPM) platform for developers, system admins and business users.

10,068

Activiti is a light-weight workflow and Business Process Management (BPM) Platform targeted at business people, developers and system admins. Its core is a super-fast and rock-solid BPMN 2 process engine for Java. It's open-source and distributed under the Apache license. Activiti runs in any Java application, on a server, on a cluster or in the cloud. It integrates perfectly with Spring, it is extremely lightweight and based on simple concepts.

Quick Overview

BPMN-js is a powerful JavaScript library for rendering and interacting with BPMN 2.0 diagrams in the browser. It allows developers to embed BPMN diagrams into web applications, providing tools for viewing, modeling, and editing business process models.

Pros

  • Easy integration into web applications
  • Extensive API for customization and extension
  • Supports both viewing and editing of BPMN diagrams
  • Active development and community support

Cons

  • Learning curve for complex customizations
  • Limited support for non-standard BPMN elements
  • Performance can be affected with very large diagrams
  • Requires additional modules for certain features (e.g., minimap)

Code Examples

  1. Creating a BPMN viewer:
import BpmnViewer from 'bpmn-js';

const viewer = new BpmnViewer({
  container: '#canvas'
});

viewer.importXML(bpmnXML)
  .then(({ warnings }) => {
    console.log('BPMN diagram rendered');
  })
  .catch(err => {
    console.error('Error rendering diagram', err);
  });
  1. Adding a custom module:
import BpmnModeler from 'bpmn-js/lib/Modeler';

const customModule = {
  __init__: ['customService'],
  customService: ['type', CustomService]
};

const modeler = new BpmnModeler({
  container: '#canvas',
  additionalModules: [customModule]
});
  1. Listening to events:
modeler.on('element.click', event => {
  const { element } = event;
  console.log('Clicked element', element.id);
});

Getting Started

To get started with BPMN-js, follow these steps:

  1. Install the library:

    npm install bpmn-js
    
  2. Import and use in your project:

    import BpmnViewer from 'bpmn-js';
    
    const viewer = new BpmnViewer({
      container: '#canvas'
    });
    
    fetch('/path/to/diagram.bpmn')
      .then(response => response.text())
      .then(bpmnXML => {
        viewer.importXML(bpmnXML);
      });
    
  3. Include the BPMN-js CSS file in your HTML:

    <link rel="stylesheet" href="node_modules/bpmn-js/dist/assets/bpmn-js.css">
    

For more advanced usage and customization options, refer to the official documentation.

Competitor Comparisons

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.

Pros of Camunda Modeler

  • Full-featured desktop application with a user-friendly interface
  • Integrated support for DMN and CMMN modeling
  • Seamless integration with Camunda Platform

Cons of Camunda Modeler

  • Less flexible for custom integrations compared to bpmn-js
  • Larger footprint and resource requirements as a standalone application

Code Comparison

bpmn-js:

import BpmnModeler from 'bpmn-js/lib/Modeler';

const modeler = new BpmnModeler({
  container: '#canvas',
  keyboard: { bindTo: document }
});

Camunda Modeler (plugin development):

module.exports = {
  name: 'My Custom Plugin',
  menu: [
    {
      label: 'Do Something',
      action: function() {
        // Custom action
      }
    }
  ]
};

While bpmn-js provides a more programmatic approach for integration into web applications, Camunda Modeler offers a plugin system for extending its functionality within the desktop environment. bpmn-js is more suitable for developers looking to embed BPMN modeling capabilities into their applications, while Camunda Modeler is a comprehensive solution for business users and process analysts who prefer a dedicated modeling tool.

A compact and highly efficient workflow and Business Process Management (BPM) platform for developers, system admins and business users.

Pros of Flowable Engine

  • Full-featured BPMN 2.0 process engine with extensive runtime capabilities
  • Supports complex business process execution, including human tasks and service integrations
  • Provides a complete BPM suite with additional modules for case management and decision automation

Cons of Flowable Engine

  • Steeper learning curve due to its comprehensive feature set
  • Heavier footprint and more complex setup compared to lightweight modeling tools
  • Primarily focused on server-side execution rather than client-side modeling

Code Comparison

BPMN.js (client-side modeling):

import BpmnModeler from 'bpmn-js/lib/Modeler';

const modeler = new BpmnModeler({
  container: '#canvas'
});

modeler.importXML(xmlString, function(err) {
  if (err) console.error('Error importing BPMN diagram', err);
});

Flowable Engine (server-side execution):

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();

Deployment deployment = repositoryService.createDeployment()
  .addClasspathResource("MyProcess.bpmn20.xml")
  .deploy();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess");

This comparison highlights the different focus areas of BPMN.js (client-side modeling) and Flowable Engine (server-side execution and process management).

10,068

Activiti is a light-weight workflow and Business Process Management (BPM) Platform targeted at business people, developers and system admins. Its core is a super-fast and rock-solid BPMN 2 process engine for Java. It's open-source and distributed under the Apache license. Activiti runs in any Java application, on a server, on a cluster or in the cloud. It integrates perfectly with Spring, it is extremely lightweight and based on simple concepts.

Pros of Activiti

  • Full-featured BPM engine with extensive process execution capabilities
  • Supports multiple deployment options (embedded, standalone, cloud)
  • Integrates well with Spring Framework and other Java ecosystems

Cons of Activiti

  • Steeper learning curve due to its comprehensive feature set
  • Heavier footprint compared to lightweight alternatives
  • Less focus on visual modeling and diagram rendering

Code Comparison

BPMN.js (JavaScript):

const viewer = new BpmnJS({
  container: '#canvas'
});

viewer.importXML(xmlString, (err) => {
  if (err) console.error('Error rendering diagram', err);
});

Activiti (Java):

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment()
  .addClasspathResource("diagram.bpmn")
  .deploy();

BPMN.js focuses on rendering and interacting with BPMN diagrams in the browser, while Activiti provides a complete process execution engine. BPMN.js is more suitable for visual modeling and diagram manipulation, whereas Activiti is designed for full process lifecycle management and execution in enterprise environments.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

bpmn-js - BPMN 2.0 for the web

Build Status

View and edit BPMN 2.0 diagrams in the browser.

bpmn-js screencast

Installation

Use the library pre-packaged or include it via npm into your node-style web-application.

Usage

To get started, create a bpmn-js instance and render BPMN 2.0 diagrams in the browser:

const xml = '...'; // my BPMN 2.0 xml
const viewer = new BpmnJS({
  container: 'body'
});

try {
  const { warnings } = await viewer.importXML(xml);

  console.log('rendered');
} catch (err) {
  console.log('error rendering', err);
}

Checkout our examples for many more supported usage scenarios.

Dynamic Attach/Detach

You may attach or detach the viewer dynamically to any element on the page, too:

const viewer = new BpmnJS();

// attach it to some element
viewer.attachTo('#container');

// detach the panel
viewer.detach();

Resources

Build and Run

Prepare the project by installing all dependencies:

npm install

Then, depending on your use-case you may run any of the following commands:

# build the library and run all tests
npm run all

# spin up a single local modeler instance
npm start

# run the full development setup
npm run dev

You may need to perform additional project setup when building the latest development snapshot.

Related

bpmn-js builds on top of a few powerful tools:

  • bpmn-moddle: Read / write support for BPMN 2.0 XML in the browsers
  • diagram-js: Diagram rendering and editing toolkit

License

Use under the terms of the bpmn.io license.

NPM DownloadsLast 30 Days