# bpmn-moddle

> A moddle wrapper for BPMN 2.0

Latest version **10.2.0** (published 2026-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install bpmn-moddle
pnpm add bpmn-moddle
yarn add bpmn-moddle
bun add bpmn-moddle
```

## Health

**Score 68/100 (B)** — status: active.

Positive: has types package; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 10.2.0 |
| Published | 2026-08-25 |
| First published | 2014-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/bpmn-moddle) |
| Module format | ESM |
| Node | >= 20.12 |
| Dependencies | 3 |
| Unpacked size | 309.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 510 |
| Author | Nico Rehwaldt |
| Maintainers | bpmn-io-admin, nikku, barmac, philippfromme, maxtru, skaiir-camunda, vsgoulart, barinali, ev-camunda, jarekdanielak, alekseymanetov |
| Keywords | bpmn, moddle, bpmn20, meta-model |

## Links

- npm: https://www.npmjs.com/package/bpmn-moddle
- Repository: https://github.com/bpmn-io/bpmn-moddle
- Homepage: https://github.com/bpmn-io/bpmn-moddle#readme
- Issues: https://github.com/bpmn-io/bpmn-moddle/issues
- npm.io page: https://npm.io/package/bpmn-moddle

## Dependencies (3)

- [moddle](https://npm.io/package/moddle.md) ^8.2.1
- [min-dash](https://npm.io/package/min-dash.md) ^5.1.0
- [moddle-xml](https://npm.io/package/moddle-xml.md) ^12.2.0

## Recent versions

- 10.2.0 (latest) — 2026-08-25
- 10.1.0 — 2026-07-27
- 10.0.0 — 2026-01-19
- 9.0.4 — 2025-09-16
- 9.0.3 — 2025-08-19
- 9.0.2 — 2025-06-10
- 9.0.1 — 2024-03-11
- 9.0.0 — 2024-03-07
- 8.1.0 — 2023-12-20
- 8.0.1 — 2023-01-31
- 8.0.0 — 2022-10-02
- 7.1.3 — 2022-08-22
- 7.1.2 — 2021-06-25
- 7.1.1 — 2021-05-27
- 7.1.0 — 2021-05-27
- … 73 more at https://npm.io/package/bpmn-moddle/versions

## README

# bpmn-moddle

[![CI](https://github.com/bpmn-io/bpmn-moddle/actions/workflows/CI.yml/badge.svg)](https://github.com/bpmn-io/bpmn-moddle/actions/workflows/CI.yml)

Read and write BPMN 2.0 diagram files in NodeJS and the browser.

__bpmn-moddle__ uses the [BPMN 2.0 meta-model](http://www.omg.org/spec/BPMN/2.0/) to validate the input and produce correct BPMN 2.0 XML.


## Usage

Get the library via [npm package](https://www.npmjs.org/package/bpmn-moddle). Consume it in NodeJS or bundle it using your favorite build tool.

```javascript
import { BpmnModdle } from 'bpmn-moddle';

const moddle = new BpmnModdle();

const xmlStr =
  '<?xml version="1.0" encoding="UTF-8"?>' +
  '<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" ' +
                     'id="empty-definitions" ' +
                     'targetNamespace="http://bpmn.io/schema/bpmn">' +
  '</bpmn2:definitions>';


const {
  rootElement: definitions
} = await moddle.fromXML(xmlStr);

// update id attribute
definitions.set('id', 'NEW ID');

// add a root element
const bpmnProcess = moddle.create('bpmn:Process', { id: 'MyProcess_1' });
definitions.get('rootElements').push(bpmnProcess);

// xmlStrUpdated contains new id and the added process
const {
  xml: xmlStrUpdated
} = await moddle.toXML(definitions);
```


## Resources

* [Issues](https://github.com/bpmn-io/bpmn-moddle/issues)
* [Examples](https://github.com/bpmn-io/bpmn-moddle/tree/master/test/spec/xml)
* [Changelog](./CHANGELOG.md)


## Building the Project

The tests include XSD schema validation. They required you to have a Java SDK installed and exposed through the `JAVA_HOME` variable.

```bash
# execute the test
npm test

# perform a full build
npm run all
```


## Related

The library is built on top of [moddle](https://github.com/bpmn-io/moddle) and [moddle-xml](https://github.com/bpmn-io/moddle-xml).


## License

Use under the terms of the [MIT license](http://opensource.org/licenses/MIT).

---
_Source: https://npm.io/package/bpmn-moddle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
