Introduction
Fineract, an open-source core banking platform hosted under the Apache Foundation, has evolved significantly over the past few years. As the community grew and contributions surged, the need for a modular architecture became critical. This article explores the journey of modularizing Fineract, the technical challenges faced, and the roadmap for future improvements.
Technical Overview
Definition and Core Concepts
Fineract is a modularized, open-source platform designed to provide banking solutions. Modularizing Fineract involves restructuring its monolithic architecture into independent, loosely coupled modules. This approach enhances scalability, maintainability, and flexibility, aligning with the Apache Foundation's commitment to open collaboration.
Key Features and Architecture
The modularization effort focuses on several critical areas:
- Layered Architecture: Separating concerns into REST API, CQRS (Command Query Responsibility Segregation), and data layers. This allows independent scaling of read and write operations.
- Data Layer Evolution: Initially using Hibernate, the team transitioned to OpenJPA and eventually EclipseLink to address licensing issues. Native SQL was replaced with PostgreSQL for better database independence.
- Modular Design: Key modules like the Report Engine and Fineract Client were decoupled, enabling independent development and deployment. The API, Data, Service, Domain, and Repository layers form a structured framework for modularization.
Practical Implementation
The modularization process involved:
- Decoupling Core Modules: Splitting the monolith into core and functional modules to reduce cross-module dependencies.
- Custom Module Development: Creating tools for automated dependency management, code generation, and Docker packaging to support custom modules.
- Testing and CI/CD: Addressing test suite scalability and build time by optimizing CI/CD pipelines and improving test isolation.
Challenges and Solutions
Technical Debt and Coupling
- Data Layer Complexity: Mixing JPA with manual SQL queries created coupling between data and service layers. Solutions include adopting QueryDSL or JQ for query generation and improving database abstraction.
- Domain Boundary Blurring: Cross-module dependencies, such as loan and user data interactions, were resolved by enforcing strict domain boundaries and refactoring data models.
- Serialization Issues: Manual JSON handling led to tight coupling between business logic and communication protocols. Future work includes transitioning to gRPC for better protocol flexibility.
Modularization Structure Design
The current module structure includes:
- API Layer: REST endpoints for external interactions.
- Data Layer: DTOs and database mappings for internal data flow.
- Service Layer: Business logic encapsulated within interfaces and implementations.
- Domain Layer: Core domain models and repositories for data persistence.
This structure aims to minimize coupling, but challenges remain in fully decoupling data and service layers.
Future Directions
Standardization and Optimization
- Spring Modulith Framework: Leveraging Spring Modulith as a reference for hybrid monolithic-modular architectures.
- OpenAPI Integration: Enhancing client tooling through OpenAPI-generated documentation and code generators to improve API usability.
- Database Independence: Expanding support for PostgreSQL and exploring alternatives to JPA for greater flexibility.
Community and Development
- Versioning Strategy: Maintaining stability with a maximum of three minor versions while increasing release frequency.
- Developer Experience: Addressing bottlenecks in the development workflow to improve productivity and reduce friction in cross-functional collaboration.
Conclusion
Modularizing Fineract represents a significant step toward enhancing scalability, maintainability, and community contributions. While challenges such as technical debt and cross-module dependencies persist, the ongoing efforts to refine the architecture and adopt modern frameworks like Spring Modulith are paving the way for a more robust and flexible platform. The journey of modularization continues, driven by the Apache Foundation's commitment to open innovation and collaboration.