Back to Insights
Technical Implementation20 min read

From BPMN to Code

Turning process diagrams into working software. The patterns, pitfalls, and production code that bridges the gap.

Brisbane, Australia
January 2026

The PDF Graveyard

90% of BPMN diagrams never become software. They sit in SharePoint, slowly becoming outdated while developers build something different. This guide bridges that gap.

State MachinesWorkflow EnginesEvent-DrivenProduction Code

BPMN Element → Code Pattern

Every BPMN element has a code equivalent. Once you see the mapping, diagrams become implementation specs.

Quick Reference: The Translation Table

BPMN
Task
→ Function
BPMN
XOR Gateway
→ if/else
BPMN
AND Gateway
→ Promise.all()
BPMN
Swimlane
→ Service/API

Testing BPMN Implementations

State Machine Test Pattern

// Test every valid transition
describe('ExpenseStateMachine', () => {
    test('DRAFT → PENDING_REVIEW on SUBMIT', () => {
        const expense = createExpense({ status: 'DRAFT', amount: 100 });
        const result = machine.transition(expense, 'SUBMIT');
        expect(result.status).toBe('PENDING_REVIEW');
    });
    
    test('PENDING_REVIEW → NEEDS_CLARIFICATION on REQUEST_INFO', () => {
        const expense = createExpense({ status: 'PENDING_REVIEW' });
        const result = machine.transition(expense, 'REQUEST_INFO');
        expect(result.status).toBe('NEEDS_CLARIFICATION');
    });
    
    // Test guards
    test('rejects APPROVE when approver is submitter', () => {
        const expense = createExpense({ 
            status: 'PENDING_REVIEW', 
            submitterId: 'user-123' 
        });
        expect(() => {
            machine.transition(expense, 'APPROVE', { approverId: 'user-123' });
        }).toThrow('Guard failed: isAuthorizedApprover');
    });
    
    // Test invalid transitions
    test('cannot go from DRAFT directly to PAID', () => {
        const expense = createExpense({ status: 'DRAFT' });
        expect(() => {
            machine.transition(expense, 'PROCESS_PAYMENT');
        }).toThrow('Invalid transition');
    });
});

Need Help Implementing Your Workflow?

We've turned dozens of BPMN diagrams into production systems. From discovery workshops to deployed code—we bridge the gap between business and engineering.