Write processes as code.
Get BPMN diagrams.

A tiny DSL that compiles plain text into standard BPMN 2.0 XML with auto-layout. Use the CLI, import as a library, or try the interactive editor.

BPMN diagram generated from code

Live compiler

Edit the DSL on the left. The BPMN XML updates instantly on the right.

input.bac
output.bpmn

Everything you need

Feature-complete BPMN 2.0 support in a single dependency.

Full BPMN 2.0

All element types: 7 task types, 10 event subtypes, 4 gateways, boundary events, pools, lanes, annotations, data objects.

CLI + Library

Use npx bpmn-compile from the command line or import compile() in your code.

Web Editor

Interactive split-pane editor with live BPMN preview. Bi-directional: edit code or drag elements.

Syntax Highlighting

Built-in highlighting for all keywords, event types, arrows, strings, and comments.

Dark & Light

Both editor and landing page support dark/light themes with OS preference detection.

62 Tests

Comprehensive test suite covering lexer, parser, generator, and full compilation integration.

DSL reference

Clean, readable syntax for every BPMN 2.0 construct.

Events & Tasks
# Events with subtypes
start: id "Label" message
end:   id "Label" terminate
catch: id "Label" timer
throw: id "Label" signal

# Boundary events
boundary: id "Label" error on task_id
boundary: id "Label" timer on task_id noninterrupting

# Task types
task: id "Label" user by "Role"
task: id "Label" service loop parallel
Flows & Structure
# Sequence flows
a -> b -> c
a --[condition]--> b
a ==> b              # default flow
a ~> b               # message flow

# Gateways
gateway: id "Label" exclusive
gateway: id "Label" parallel
gateway: id "Label" eventbased

# Pools, lanes, annotations
pool: id "Pool"
lane: id "Lane" in pool_id
note: id "Text" on task_id

Install

Zero config. One dependency. Works everywhere.

Terminal
$ npm install bpmn-as-code $ npx bpmn-compile process.bac --png