npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bpmn-as-code

v0.1.0

Published

A DSL that compiles to BPMN 2.0 XML diagrams — write processes as code, get standard BPMN

Readme

BPMN-as-Code

Write business processes as plain text, get standard BPMN 2.0 diagrams.

process "Order Fulfillment"

start: order_received "Order Received"
end:   order_complete "Order Complete"

task: validate "Validate Order" user by "Sales Team"
task: payment  "Process Payment" service
task: ship     "Ship Order"     by "Warehouse"

gateway: is_valid "Is Order Valid?" exclusive

order_received -> validate -> is_valid
is_valid --[yes]--> payment -> ship -> order_complete
is_valid --[no]-->  order_complete

Order Fulfillment diagram

Install

npm install bpmn-as-code

CLI Usage

# Compile DSL to BPMN XML
npx bpmn-compile process.bac

# Compile with PNG export
npx bpmn-compile process.bac --png

# Specify output path
npx bpmn-compile process.bac output.bpmn

Library Usage

import { compile } from 'bpmn-as-code';

const result = compile(`
  process "My Process"
  start: a "Start"
  end: b "Done"
  a -> b
`);

if (result.xml) {
  console.log(result.xml);       // BPMN 2.0 XML string
  console.log(result.nodeCount); // 2
  console.log(result.flowCount); // 1
} else {
  console.error(result.error);   // Parse error with line/col
}

For more control, import individual modules:

import { parse } from 'bpmn-as-code/parser';
import { generate } from 'bpmn-as-code/generator';

const ast = parse(source);
const xml = generate(ast);

Web Editor

Open editor/index.html in a browser for an interactive editor with live preview, syntax highlighting, and a dark/light theme toggle.

DSL Syntax Reference

Process Declaration

process "Process Name"

Events

start:    id "Label"                                    # plain start
start:    id "Label" message                            # message start
start:    id "Label" timer                              # timer start
end:      id "Label"                                    # plain end
end:      id "Label" terminate                          # terminate end
end:      id "Label" error                              # error end
catch:    id "Label" timer                              # intermediate catch
throw:    id "Label" signal                             # intermediate throw
boundary: id "Label" error on parent_id                 # interrupting boundary
boundary: id "Label" timer on parent_id noninterrupting # non-interrupting

Event subtypes: message, timer, signal, error, terminate, escalation, compensate, conditional, link, none

Tasks

task: id "Label"                          # generic task
task: id "Label" user by "Role"           # user task with performer
task: id "Label" service                  # service task
task: id "Label" script                   # script task
task: id "Label" send                     # send task
task: id "Label" receive                  # receive task
task: id "Label" manual                   # manual task
task: id "Label" businessrule             # business rule task
task: id "Label" service loop             # standard loop
task: id "Label" service loop parallel    # multi-instance parallel
task: id "Label" service loop sequential  # multi-instance sequential

Activities

subprocess: id "Label"
call:       id "Label"

Gateways

gateway: id "Label" exclusive    # XOR (default if omitted)
gateway: id "Label" parallel     # AND
gateway: id "Label" inclusive    # OR
gateway: id "Label" eventbased  # event-based

Flows

a -> b -> c                # sequence flow (chainable)
a --[condition]--> b       # conditional flow
a ==> b                    # default flow
a ~> b                     # message flow (between pools)

Pools & Lanes

pool: id "Pool Name"
lane: id "Lane Name" in pool_id

Annotations & Data

note:      id "Text" on element_id    # text annotation
data:      id "Label"                 # data object
datastore: id "Label"                 # data store

Comments

# This is a comment

Examples

See the examples/ directory:

License

MIT