Skip to content

emaarco/bpmn-to-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

229 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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.

Documentation Web App Maven Central Gradle Plugin Portal

bpmn-to-code

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 preview

What It Does

Generate β€” Type-Safe APIs

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() { ... }

Validate β€” Architecture Rules for BPMN (beta)

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.

Surface β€” Process Structure in Code (beta)

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.

Ship β€” Agent Skills (beta)

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-code

Works with Claude Code out of the box.

Gradle Setup

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
}

Maven Setup

<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>

Testing Module

dependencies {
    testImplementation("io.github.emaarco:bpmn-to-code-testing:2.0.0")
}

Supported Engines

Engine Value
Camunda 8 / Zeebe ZEEBE
Camunda 7 / CIB7 CAMUNDA_7
Operaton OPERATON

Get It

Project Structure

  • 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

Contributing

Community contributions are welcome. Submit issues, open pull requests, or start a discussion on GitHub.

About

Gradle and Maven plugin that bridges gaps between BPMN and code - fostering the creation of clean process-automation solutions πŸͺ΄

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors