Task Flow Engine — a configurable rule engine

A rule engine and visual flow editor for a corporate lending platform · Java/Spring · Vue 3 + GoJS + Electron

This was a team project (3 people) at my employer. The source code belongs to the company and is not public. This page describes the architecture and the parts I owned; it contains no real business rules or client information. I rewrote the expression-engine portion clean-room as a runnable open-source library: flow-expression-engine.

The problem

Batch and workflow-style financial processing runs a chain of conditional checks over many records, branching and looping on the results. The conventional approach writes those rules directly into code — so every rule change means editing, testing and redeploying. The codebase swells as rules accumulate, logic scatters, and nothing is traceable. In banking, business rules are precisely the thing that changes most often.

The design: turn flow logic into data

Business checks never enter the codebase. Each step of a flow is one row in a configuration table; the engine reads that configuration and assembles an executable chain of tasks. Changing a rule becomes data maintenance rather than a code change.

TASK_FLOW  (one row = one task node)
├─ TASK_TYPE        CONTROL (branch/loop) │ OPERATOR (compute) │ QUERY (lookup)
├─ BLOCK_ID / SEQ   the block a task belongs to, and its order within that block
├─ NEXT_BLOCK_ID    the block to branch to when the condition holds
├─ NESTED_BLOCK_ID  nested block — the body of a FOR loop
├─ SOURCE_FROM      data source: query result │ variable pool
├─ LOGIC_TYPE …     EQUAL / GREATER / LESS / ALWAYS + target field and comparison value
├─ OPERATOR_EXPRESSION  expression (arithmetic, dates, financial functions)
└─ VARIABLE_NAME    name under which a result is stored in the variable pool

At runtime the engine walks tasks from the starting block in sequence order: CONTROL tasks decide where the flow goes (including FOR loops and nested loops), OPERATOR tasks write results into the variable pool, and QUERY tasks fetch data for later conditions to use. Those three task types compose into a complete business-check flow — and every decision leaves a log entry behind.

The expression engine: from string to executable decision

A rule stored in a table is just a string. Turning it into safe program behaviour takes a small compilation pipeline. I rewrote this part clean-room as an open-source library: flow-expression-engine (pure Java 17, zero dependencies, 15 tests) — everything described here actually runs there.

"AMT * 0.8 > LIMIT"  ─→  Shunting-yard  ─→  RPN
                                            │
                variable lookup ←──  Predicate / SpEL  ←┘

Dynamic queries: even "what to look up" is data

Query rules are configuration too: a SOURCE_RULE table defines the target table, the selected columns and the where clause. At runtime the query is assembled with the JPA Criteria API, with column names mapped SNAKE_CASE → camelCase onto entities. Adding a new data source takes one configuration row, not a new repository method.

Flow Studio: an editor for humans

Rules living in database rows are a nightmare to maintain by hand — hence the visual editor. GoJS renders the whole task flow, node properties and branches are edited directly on the canvas, and JSON import/export bridges back to the tables. It ships to the team as a desktop application packaged with Electron.

LayerStack
EngineJava · Spring Boot · rule tables · full execution log
EditorVue 3 (Composition API) · TypeScript · Vite · GoJS · PrimeVue
PackagingElectron Forge (Windows release)
TestingPlaywright E2E · Vitest · JUnit

What I owned

Trade-offs (the questions I get asked, answered up front)

← cd ~