Mifos X implementation lacks a sophisticated workflow management system that seamlessly integrates both internal processes and interactions with external systems. An integration with a workflow engine such as Flowable makes life easier, meaning that non-tech folks can finally join the party dragging and dropping steps like they’re playing a game of Tetris. This reduces errors, speeds up process management, and fills the gap between Mifos X's core banking capabilities and advanced workflow automation.
- Name: Hossam Hatem Ragab Abu-Elhadid
- Email: 7ossam7atem1@gmail.com
- GitHub: 7ossam7atem1
- LinkedIn: hossam-hatem
- Github Repository
- Postman collection
- Mifos Forge
Mifos users need greater flexibility and control over creating loan and customer onboarding workflows that integrate both internal processes and external systems.
This project focuses on building an external integration with a workflow engine (such as Flowable or jBPM) using the Mifos X REST API as the bridge. The auto-generated client library from the back end ensures a reliable contract between the workflow engine and the core banking system.
By leveraging this integration, the core banking system and its REST API serve as the central connector, enabling a UI-driven workflow engine where non-technical users can design and customize workflows. Through a drag-and-drop interface, users can easily define the various steps of a process, allowing for tailored and efficient loan management and customer onboarding.
Mifos X currently provides only basic workflow management capabilities, which fall short of modern standards. Our goal is not just to integrate Flowable and stop there, but to build a solution that is flexible and extensible, enabling easy migration to other workflow engines in the future.
We are starting with Flowable because it is highly regarded in the open-source community for its robustness and flexibility. Its support for BPMN 2.0 makes it ideal for modeling and executing complex business processes while providing clear, visualized workflows that are easily understood by non-technical users. Flowable’s active community also ensures continuous improvement, long-term sustainability, and strong support.
Moreover, Flowable’s seamless integration with Java and REST APIs makes it a perfect fit for Mifos X, allowing us to automate critical workflows such as payments, KYC, and AML/TF efficiently.
At the same time, we are keeping the design engine-agnostic, ensuring that the system can later integrate with other workflow solutions such as Temporal, Orkes, or AWS SWF. This approach prevents vendor lock-in and ensures the long-term adaptability of the platform.
- Introducing a WorkflowEngine layer, acting as an abstraction interface where different workflow engines can be integrated easily. Think of it as a generic adapter, keeping Mifos X core clean and adaptable by allowing various engines to plug in like different attachments for a tool.
- Within this layer, we are employing Factory Pattern to dynamically select appropriate engine based on configurations, making it straightforward to switch from Flowable to Temporal or another engine by just updating the configuration file.
- By starting with flowable, this layer ensures that Mifos X is set up to be compatible with various workflow engines in the future, enhancing the power and adaptability for all users not just the tech savvy ones.
- We will be able to streamline processes like payments, KYC, AML/TF, improving efficiency and compliance in financials.
- Before the coding period, I worked on setting up the project structure and familiarizing myself with Mifos and the Fineract Client that I was going to use.
- Initialized the project skeleton and added the Fineract Java client library as the foundation. Implemented the
WorkflowEngineinterface to define workflow operations and introduced theWorkflowEngineFactoryto enable dynamic engine selection. Built the first engine integration with theFlowableWorkflowEngineand added configuration properties to support flexibility and easy switching. The database was switched from H2 in-memory to MySQL for greater consistency. In addition, created theFineractAuthServicefor handling authentication with the Fineract system and theFineractClientServicefor client onboarding, including creating and activating clients. Finally, refined the overall project structure for better organization(#PR1).
-
Migrated the Fineract client integration from the older Java Fineract client to the new Kotlin Multiplatform (KMP) client to improve cross-platform compatibility and long-term maintainability. Refactored both the
FineractClientServiceandFineractAuthServiceto use the KMP client APIs, updating all service methods along with their request and response handling. Input validation and error handling were enhanced across all client-related service methods to ensure more robust and predictable behavior. In addition, the test suite was updated and expanded to cover all service methods, including validation and error scenarios, to guarantee higher reliability and code quality(#PR3). -
Refactored the
FineractAuthServiceto return anObservable<AuthenticationResponse>using RxJava instead of CompletableFuture for handling authentication. All logic and error handling were updated to maintain functional equivalence with the previous implementation. TheFineractAuthServiceTestwas also refactored to use RxJava’sblockingFirst()andTestObserverfor assertions and error validation, ensuring consistent and reliable test coverage(#PR4).
-
Updated the
FineractClientServicemethods to accept their respective DTOs instead of raw maps, eliminating the risk of runtime errors from incorrect map keys or value types and ensuring strong type safety. All outgoing data to APIs is now wrapped in DTOs, with internal conversion to maps handled through dedicated .toMap() methods. TheFineractClientServiceTestwas refactored to use DTOs instead of maps, with test matchers and error message assertions updated to match the new DTO-based signatures and service logic. Most cases were thoroughly tested and covered to ensure reliability and correctness(#PR11). -
Added the AsciiDoc Maven plugin
(asciidoctor-maven-plugin:2.2.1)to the pom.xml and configured it withdocs/asciidoc/as the source directory anddocs/generated/as the output directory. Set up the HTML5 backend with enhanced features for generating documentation. Also introduced adocs/README.mdfile as a comprehensive guide for writing and maintaining project documentation(PR#13).
- Completed the
ClientApicoverage in Fineract-KMP by implementing full and basic client creation, retrieval, update, activation, closure, and deletion (pending only). Added support for client status management, including reject, withdraw, reactivate, undo reject, and undo withdraw. Implemented functionality to assign and unassign staff to clients, update the default savings account, and handle client transfers with operations such as propose, withdraw, reject, accept, and propose-and-accept. Also enabled performing all client operations using external IDs(PR#16).
- This pull request establishes the foundational architecture for the Mifos Workflow service by integrating the Flowable BPMN workflow engine with proper initialization, error handling, and Spring DataSource support, along with a
WorkflowEngineFactoryfor engine management. It introduces a robust authentication layer throughFineractAuthService, ensuring all workflow operations are secured, and sets up core BPMN process definitions forclient onboarding,transfers, andoffboardingwith placeholder delegates for future implementations. A centralizedGlobalExceptionHandlerhas been implemented in compliance withRFC 7807to deliver consistent, structured error responses for validation, business, and runtime errors. The configuration has been enhanced viaWorkflowConfig,FineractApiConfig, and application properties to support workflow, authentication, and database settings. TheWorkflowServiceprovides high-level workflow operations abstracting engine and authentication details, while basic tests confirm engine and authentication integration(PR#24).
-
Introduced robust error handling with new
FineractApiExceptionandWorkflowException, ensuring all errors follow theRFC-7807details format. AddedineractErrorHandlerandWorkflowErrorHandlerutilities for consistent error extraction, logging, and mapping across the service. Implemented BPMN 2.0 delegates for client onboarding steps including creation, staff assignment, activation, and rejection, with built-in validation and error handling. Expanded core workflow models to track process status, completion, and active process instances, and introduced workflow engine statistics along with process control request models. Refactored Fineract client and authentication services to adopt the new error handling utilities for uniform processing. EnhancedFlowableWorkflowEngineandFlowableMapperfor better process management and extensibility, and updatedWorkflowServiceto align with the new engine and mapping logic. AddedClientOnboardingControllerandAuthenticationControllerto expose workflow and authentication endpoints, and introducedAuthenticationStatusDTOfor standardized authentication responses(PR#25). -
Updated all tests to expect
FineractApiExceptioninstead of rawIllegalStateExceptionorRuntimeException, aligning them with the service’s new error-wrapping logic. Each test now validates error messages against those produced byFineractErrorHandler(e.g., “Failed to retrieve closure reasons for resource ClientClosureReason”), ensuring consistency across client and authentication tests. This resolves previous failures caused by the shift to wrapped exceptions and strengthens the test suite with more robust, future-proof error handling(PR#27). -
Added Docker support with a multi-stage
Dockerfileusing Maven 3.9.6 and OpenJDK 21 to produce a lean, optimized image. Introduced a fulldocker-compose.ymlsetup orchestrating MySQL 8.0 alongside the Spring Boot app, and added a.dockerignorefile to exclude unnecessary files for faster builds. Also configured Spring Boot Actuator in application.properties to enable application monitoring and management(PR#28).
-
Introduced
ClientTransferControllerto manage the client transfer workflow, with delegates for proposing, accepting, and rejecting transfers, all backed by robust error handling and Fineract integration. Updated DTOs to align with Fineract API requirements by removing unsupported fields and enforcing proper dateFormat and locale. Enhanced the BPMN process to leverage Spring beans and correctly manage assignee variables, while improving error handling and workflow variable management across the transfer lifecycle(PR#33]. -
Added
ClientOffboardingControllerto handle the client offboarding workflow, with delegates for closing accounts, retrieving closure reasons, and verifying client accounts, all integrated with Fineract and backed by robust error handling. Updated DTOs to comply with both Fineract API and workflow requirements, and enhanced the BPMN process to leverage Spring beans with correctly managed assignee variables(PR#36).
-
Added a comprehensive unit test suite for the Mifos Workflow service, covering controllers, exception handling, workflow engine, and utilities. Controller tests include authentication (
AuthenticationControllerTest), client onboarding (ClientOnboardingControllerTestwithLocalDatehandling), client offboarding (ClientOffboardingControllerTestwith exception scenarios), and client transfer (ClientTransferControllerTestwith date validation). Enhanced error handling coverage withGlobalExceptionHandlerTest,FineractErrorHandlerTestfor HTTP exception scenarios and error body extraction, and reflection-based testing forMethodArgumentNotValidException. Strengthened workflow engine reliability withFlowableWorkflowEngineTest(API mocking),WorkflowEngineFactoryTest(reflection-based init testing), andWorkflowEngineTestto validate the interface contract, including mockedProcessEngineservices and query chains. Also added WorkflowErrorHandlerTest for exception pattern matching, covering both Supplier and Runnable overloads, while verifying error code mappings and exception creation(PR#37). -
Delivered a complete documentation suite for the Mifos Workflow service. Added an index.adoc home page with project overview, architecture, and a quick start guide; a full api-reference.adoc with REST API documentation and examples;
workflow-processes.adocfor detailed BPMN workflow descriptions;deployment-guide.adocfor setup, deployment, and operations; andconfiguration-reference.adocas a comprehensive configuration guide. Enhanced the docs with rich visuals, including an architecture diagram, BPMN process diagrams for client onboarding, offboarding, and transfer workflows, Fineract API integration diagrams, and an error handling flow for troubleshooting. All documentation is structured in AsciiDoc with Maven integration via theasciidoctor-maven-plugin, image handling throughmaven-resources-plugin, and a professional navigation system with cross-document linking(PR#38).
- Introduced
LoanOriginationControllerto manage Mifos X loan origination workflows, with delegates for submitting, approving, and rejecting loan applications, all integrated with Fineract and backed by robust error handling. Added DTOs aligned with Fineract API requirements and updated the BPMN process to leverage these delegates, verified through Flowable Modeler testing. Strengthened the workflow with full error handling and variable management across the loan origination lifecycle(PR#40).
-
Added LoanDisbursementController to handle Mifos X loan disbursement workflows, with Flowable delegates for processing disbursement requests and verifying loan status, fully integrated with Fineract and supported by robust error handling. Introduced DTOs aligned with Fineract API requirements and updated the BPMN process to use these delegates, validated through Flowable Modeler testing. Enhanced the workflow with comprehensive error handling and variable management throughout the disbursement lifecycle(PR#41).
-
Introduced LoanCancellationController to manage Mifos X loan cancellation workflows, with Flowable delegates to handle cancellation operations and DTOs aligned with Fineract API requirements. Designed and tested a BPMN 2.0 process model that leverages these delegates, verified through Flowable Modeler for correctness and reliability(PR#44).
-
Introduced a standardized API response wrapper with fields for success, message, optional data, and an ISO timestamp, along with static factory methods for simplified response creation. Updated controller endpoints to return
ResponseEntity<ApiResponse<Void>>instead ofResponseEntity<Void>, and aligned all corresponding tests to match. Also fixed the loan disbursement delegate to correctly use the approved amount rather than the transaction amount during the manager review task in the disbursement workflow(PR#45).
-
Added a comprehensive unit test suite for all implemented Mifos workflows, covering controllers, services, delegates, utilities, and exceptions. Controller tests validate endpoints across loan, client, and authentication workflows, while service tests mock Fineract API integrations. BPMN delegates are thoroughly tested for execution flow, error handling, and variable management, including staff assignment, client creation, activation, rejection, transfer, closure, account verification, and loan workflows (creation, approval, rejection, disbursement, and status verification). Specific tests such as
LoanApprovalDelegateTest(date formatting and note handling),LoanDisbursementDelegateTest(retry logic and error handling), andLoanStatusVerificationDelegateTest(comprehensive loan data validation) ensure robustness of key processes. Utility classes and custom exception handling are also tested to guarantee consistent behavior across the workflow engine(PR#46). -
Fixed loan cancellation and disbursement tests to align with workflow behavior. Extended
WorkflowExceptionto include loan-specific exceptions for more accurate error handling. Cleaned up theApiResponsewrapper by removing duplicated code and adding Lombok’s@Getterannotation for simplicity and maintainability(PR#47). -
Documented all remaining functionalities, including loan workflows, and added BPMN 2.0 process model diagrams to the AsciiDoc suite. Updated the README file to reflect the latest features and documentation resources(PR#48).
- Implement more additional workflows from Mifos X APIs provided by Fineract-KMP client.
- Adding retry mechanisms For advanced ainancial workflows.
- Integrating the module with other Modules when finished like Loan Risk Assessment and Credit Bureau.
- Integrating the Module with a Web-based tooling for BPMN, DMN and Forms Like BPMN.io.
- Enhanced my knowledge of Java and Spring Boot.
- Learned how to work effectively as part of a team.
- Gained experience in using source control systems (Git, GitHub, and Docker).
- Understood and dealt with technical debt in practice.
- Improved my time management skills.
- Strengthened my communication skills.
- Deepened my understanding of the microfinance domain.
I am deeply grateful to my mentors Ed Cable, Yash Sancheti, and Victor Romero for their invaluable support and guidance throughout this project. They continuously reviewed my work, helped me navigate key technical decisions, and pointed me toward the right concepts and resources whenever I needed help. Their support was both technical and personal, and I truly appreciate the time and effort they dedicated to mentoring me.
I also want to thank the GSoC organizers and admins for their constant support in making this program a smooth and rewarding experience.