bpmn-to-code is early-stage and actively developing. The four pillars β Generate, Validate, Surface, Ship β are taking shape, but expect rough edges. Feedback and contributions are very welcome.
Type-safe constants from your BPMN model β for your compiler, your tests, and your AI agents.
Generate Β· Validate Β· Surface Β· Ship β a type-safe BPMN toolkit for JVM projects.
bpmn-to-code reads your BPMN files and generates typed constants from them. Every element ID, message name, and service task type becomes a compiled constant. Rename a task in the modeler β compiler error. No more silent runtime failures from hardcoded strings.
// Before
@JobWorker(type = "newsletter.sendConfirmationMail") // copied from modeler, no safety net
fun send() { ... }
// After β generated from the BPMN model
@JobWorker(type = NewsletterSubscriptionProcessApi.ServiceTasks.NEWSLETTER_SEND_CONFIRMATION_MAIL)
fun send() { ... }Like ArchUnit for Java, bpmn-to-code-testing lets you write architecture tests for your BPMN models. The standalone validateBpmnModels Gradle task and validate-bpmn Maven goal run the same checks in CI.
BpmnValidator
.fromClasspath("bpmn/")
.engine(ProcessEngine.ZEEBE)
.validate()
.assertNoViolations()11 built-in rules cover missing implementations, undefined timers, empty processes, naming violations, and variable collisions. Add custom rules by implementing BpmnValidationRule.
Generates a structured JSON alongside the API. Your process is readable by AI agents, code reviewers, and CI β without opening Camunda Modeler.
{
"processId": "newsletterSubscription",
"flowNodes": [
{ "id": "StartEvent_SubmitRegistrationForm", "displayName": "Submit newsletter form", "elementType": "START_EVENT" },
{ "id": "Activity_SendConfirmationMail", "displayName": "Send confirmation mail", "elementType": "SERVICE_TASK" }
]
}BPMN files are XML β technically readable, but full of visual layout data, namespace declarations, and rendering hints that make them noisy for AI tools. The generated JSON strips all of that away:
- Smaller β no diagram coordinates, waypoints, or SVG-style metadata
- Focused β only the elements and relationships that matter for logic and implementation
- Structured β flow nodes, sequence flows, messages, and errors in predictable, typed fields
The result is a compact, deterministic representation that AI agents can reason about accurately β with no hallucinated element IDs, because the JSON is derived directly from the BPMN model by rule.
Drop-in agent skills that automate the entire setup workflow. Integrate the plugin into your project in one prompt, scaffold a complete process service from a BPMN file, and migrate hardcoded strings to the generated API β without touching any config manually.
/plugin marketplace add emaarco/bpmn-to-code
/plugin install bpmn-to-code@bpmn-to-codeWorks with Claude Code out of the box.
plugins {
id("io.github.emaarco.bpmn-to-code-gradle") version "2.0.0"
}
tasks.named("generateBpmnModelApi", GenerateBpmnModelsTask::class) {
baseDir = projectDir.toString()
filePattern = "src/main/resources/**/*.bpmn"
outputFolderPath = "$projectDir/src/main/kotlin"
packagePath = "com.example.process"
outputLanguage = OutputLanguage.KOTLIN
processEngine = ProcessEngine.ZEEBE
}<plugin>
<groupId>io.github.emaarco</groupId>
<artifactId>bpmn-to-code-maven</artifactId>
<version>2.0.0</version>
<executions>
<execution>
<goals><goal>generate-bpmn-api</goal></goals>
</execution>
</executions>
<configuration>
<baseDir>${project.basedir}</baseDir>
<filePattern>src/main/resources/*.bpmn</filePattern>
<outputFolderPath>${project.basedir}/src/main/java</outputFolderPath>
<packagePath>com.example.process</packagePath>
<outputLanguage>KOTLIN</outputLanguage>
<processEngine>ZEEBE</processEngine>
</configuration>
</plugin>dependencies {
testImplementation("io.github.emaarco:bpmn-to-code-testing:2.0.0")
}| Engine | Value |
|---|---|
| Camunda 8 / Zeebe | ZEEBE |
| Camunda 7 / CIB7 | CAMUNDA_7 |
| Operaton | OPERATON |
- π¦ Maven Central β Maven Plugin
- π¦ Gradle Plugin Portal β Gradle Plugin
- π Web App β Try in browser, no installation
- π³ Docker Hub β Self-hostable container
- π€ MCP Server β AI-assisted generation inside your editor
- bpmn-to-code-core β core parsing and generation logic
- bpmn-to-code-gradle β Gradle plugin
- bpmn-to-code-maven β Maven plugin
- bpmn-to-code-testing β BPMN architecture testing library
- bpmn-to-code-web β browser-based web app
- bpmn-to-code-mcp β MCP server for AI-assisted generation
Community contributions are welcome. Submit issues, open pull requests, or start a discussion on GitHub.
