# aizuda/flowlong architecture

> Architecture diagram of the GitHub repository aizuda/flowlong, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aizuda/flowlong
- Repository: https://github.com/aizuda/flowlong

## Overview

##### Project type and purpose
- This is an open-source Java workflow engine framework (“FlowLong” / 飞龙工作流).
- It provides a core BPMN-style workflow engine, persistence adapters, framework integration plugins, and example applications.
- Use cases: embed in Spring Boot or Solon apps, run process models stored in JSON, manage tasks, timers, branches, reminders, triggers, etc.

##### File structure
- Top-level modules:
- db: SQL scripts for MySQL, Oracle, PostgreSQL
- flowlong-core: core engine implementation (services, parsers, schedulers, DAO interfaces, entities, handlers, listeners)
- flowlong-mybatis-plus: MyBatis-Plus adapter implementing DAO interfaces
- flowlong-solon-plugin: Solon framework plugin (auto-configuration, adaptive handlers)
- flowlong-spring-boot-starter: Spring Boot auto-configuration and event integration
- flowlong-solon-example & flowlong-spring-boot-example: sample applications demonstrating integration
- Build files (Gradle, Maven) and CI/CD definitions (.github, .gitee) at root.

##### README for additional insights
- Highlights over 40 built-in workflow features (splits, joins, sub-process, countersign, delegation, reminders, timers, triggers, etc.).
- Relies on MyBatis-Plus as ORM.
- Inspired by Activiti, Flowable, Camunda design ideas.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Core Engine Layer
    subgraph "Core Engine Layer"
        CE["Core Engine"]:::core
        PMCache["ProcessModelCache"]:::core
        PMParser["ProcessModelParser"]:::core
        RuntimeService["RuntimeService"]:::core
        TaskService["TaskService"]:::core
        QueryService["QueryService"]:::core
        ProcessService["ProcessService"]:::core
        Scheduler["FlowLongScheduler"]:::core
        DAOInt["DAO Interfaces"]:::core
    end

    %% Persistence Adapter Layer
    subgraph "Persistence Adapter"
        MPAdapter["MyBatis-Plus Adapter"]:::adapter
        Mappers["MyBatis-Plus Mappers"]:::adapter
    end

    %% Integration Plugins Layer
    subgraph "Integration Plugins"
        subgraph "Spring Boot Starter"
            SBStarter["FlowLongAutoConfiguration"]:::plugin
            HandlerSB["FlowJacksonHandler"]:::plugin
            ExprSB["SpelFlowLongExpression"]:::plugin
            ListenersSB["Event Listeners"]:::plugin
        end
        subgraph "Solon Plugin"
            SolonAuto["FlowLongAutoConfiguration"]:::plugin
            SolonJson["SolonFlowJsonHandler"]:::plugin
            SolonExpr["SolonFlowLongExpression"]:::plugin
            XPlugin["XPluginImpl"]:::plugin
        end
    end

    %% Example Applications
    subgraph "Example Applications"
        SBExample["Spring Boot Example"]:::example
        SolonExample["Solon Example"]:::example
    end

    %% External Systems
    DB["Relational Database"]:::external

    %% Connections
    CE -->|uses cache/parser| PMCache
    CE -->|uses cache/parser| PMParser
    CE -->|exposes APIs| RuntimeService
    CE -->|exposes APIs| TaskService
    CE -->|exposes APIs| QueryService
    CE -->|exposes APIs| ProcessService
    CE -->|schedules timers| Scheduler
    CE -->|defines interfaces| DAOInt
    DAOInt -->|implemented by| MPAdapter
    MPAdapter -->|uses mappers| Mappers
    Mappers -->|SQL queries| DB

    SBStarter -->|auto-configures| CE
    HandlerSB -->|registers handlers| CE
    ExprSB -->|expression engine| CE
    ListenersSB -->|hooks events| CE

    SolonAuto -->|auto-configures| CE
    SolonJson -->|registers handlers| CE
    SolonExpr -->|expression engine| CE
    XPlugin -->|integrates plugin| CE

    SBExample -->|REST API calls| SBStarter
    SBExample -->|invokes services| CE
    SolonExample -->|controller calls| SolonAuto
    SolonExample -->|invokes services| CE

    Scheduler -->|polls timers| CE

    %% Click Events
    click PMCache "https://github.com/aizuda/flowlong/blob/main/flowlong-core/src/main/java/com/aizuda/bpm/engine/ProcessModelCache.java"
    click PMParser "https://github.com/aizuda/flowlong/blob/main/flowlong-core/src/main/java/com/aizuda/bpm/engine/ProcessModelParser.java"
    click Scheduler "https://github.com/aizuda/flowlong/blob/main/flowlong-core/src/main/java/com/aizuda/bpm/engine/FlowLongScheduler.java"
    click DAOInt "https://github.com/aizuda/flowlong/tree/main/flowlong-core/src/main/java/com/aizuda/bpm/engine/dao"
    click RuntimeService "https://github.com/aizuda/flowlong/blob/main/flowlong-core/src/main/java/com/aizuda/bpm/engine/RuntimeService.java"
    click TaskService "https://github.com/aizuda/flowlong/blob/main/flowlong-core/src/main/java/com/aizuda/bpm/engine/TaskService.java"
    click QueryService "https://github.com/aizuda/flowlong/blob/main/flowlong-core/src/main/java/com/aizuda/bpm/engine/QueryService.java"
    click ProcessService "https://github.com/aizuda/flowlong/blob/main/flowlong-core/src/main/java/com/aizuda/bpm/engine/ProcessService.java"
    click MPAdapter "https://github.com/aizuda/flowlong/tree/main/flowlong-mybatis-plus/src/main/java/com/aizuda/bpm/mybatisplus/impl"
    click Mappers "https://github.com/aizuda/flowlong/tree/main/flowlong-mybatis-plus/src/main/java/com/aizuda/bpm/mybatisplus/mapper"
    click SBStarter "https://github.com/aizuda/flowlong/blob/main/flowlong-spring-boot-starter/src/main/java/com/aizuda/bpm/spring/autoconfigure/FlowLongAutoConfiguration.java"
    click HandlerSB "https://github.com/aizuda/flowlong/blob/main/flowlong-spring-boot-starter/src/main/java/com/aizuda/bpm/spring/adaptive/FlowJacksonHandler.java"
    click ExprSB "https://github.com/aizuda/flowlong/blob/main/flowlong-spring-boot-starter/src/main/java/com/aizuda/bpm/spring/adaptive/SpelFlowLongExpression.java"
    click ListenersSB "https://github.com/aizuda/flowlong/tree/main/flowlong-spring-boot-starter/src/main/java/com/aizuda/bpm/spring/event"
    click SolonAuto "https://github.com/aizuda/flowlong/blob/main/flowlong-solon-plugin/src/main/java/com/aizuda/bpm/solon/autoconfigure/FlowLongAutoConfiguration.java"
    click SolonJson "https://github.com/aizuda/flowlong/blob/main/flowlong-solon-plugin/src/main/java/com/aizuda/bpm/solon/adaptive/SolonFlowJsonHandler.java"
    click SolonExpr "https://github.com/aizuda/flowlong/blob/main/flowlong-solon-plugin/src/main/java/com/aizuda/bpm/solon/adaptive/SolonFlowLongExpression.java"
    click XPlugin "https://github.com/aizuda/flowlong/blob/main/flowlong-solon-plugin/src/main/java/com/aizuda/bpm/solon/XPluginImpl.java"
    click SBExample "https://github.com/aizuda/flowlong/tree/main/flowlong-spring-boot-example/src/main/java/com/aizuda/bpm/spring/example"
    click SolonExample "https://github.com/aizuda/flowlong/tree/main/flowlong-solon-example/src/main/java/com/aizuda/bpm/solon/example"

    %% Styles
    classDef core fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef adapter fill:#E6FFED,stroke:#28A745,color:#28A745;
    classDef plugin fill:#FFF5B1,stroke:#DBAB09,color:#DBAB09;
    classDef example fill:#FFD7D9,stroke:#CB2431,color:#CB2431;
    classDef external fill:#F0F0F0,stroke:#6A737D,color:#6A737D;
```
