Fineract Client KMP is a Kotlin Multiplatform library built with Ktorfit that enables interaction with the Apache Fineract 1.x Platform. This library includes all necessary services and data payload models, along with a Ktorfit instance used by the Fineract Client KMP SDK.
All services and payload models in this library are generated using the OpenAPI Generator. However, FineractClient.kt is not a generated file. it is responsible for creating the Ktorfit instance and serves as the entry point for accessing the services within the Fineract Client KMP SDK.
The library is organized into three main packages inside the fineract-client module:
-
models - Contains all the payloads, including request and response models for various services.
-
apis - Includes all service interfaces, such as ClientService, AuthService, etc.
-
infrastructure - Contains the FineractClient.kt file, which initializes the Ktorfit instance and exposes all services to the Fineract Client KMP SDK.
- Follow these steps to generate data models and services using OpenAPI Tools:
- Install NPM (Skip this step if you already have npm installed).
- Install OpenAPI Generator CLI using npm:
npm install @openapitools/openapi-generator-cli -g
- Download the fineract.yml file from Here
-
Once OpenAPI Generator CLI is installed, use the following command to generate the code:
openapi-generator-cli generate \ -i "C:\Users\Aditya\Downloads\fineract.yaml" \ -o "C:\Users\Aditya\Desktop\MIFOS\web-app\packages\fineract-client\src" \ -g kotlin \ --library=jvm-retrofit2 \ --additional-properties=useCoroutines=true,returnPlainBody=true \ --skip-validate-spec -
Replace
-i "C:\Users\Aditya\Downloads\fineract.yaml"with the actual path to your fineract.yml file. -
Note: Back in 2024, when these data models and services were generated, Ktorfit support was not available. So, we generated them using Retrofit2 and later modified the services to use Ktorfit. In the future, before generating the code, check whether Ktorfit support is available.
Add dependency in the build.gradle.
-
Kts
dependencies { implementation("com.github.openMF:fineract-client-kmp:$version") } -
Groovy
dependencies { implementation 'com.github.openMF:fineract-client-kmp:$version' }
Add this in your root settings.gradle.
-
Kts
dependencyResolutionManagement { repositories { maven { setUrl("https://jitpack.io") } } } -
Groovy
allprojects { repositories { maven { url 'https://jitpack.io' } } }
Thank you for your interest in contributing to the Fineract Client KMP project by Mifos! We welcome all contributions and encourage you to follow these guidelines to ensure a smooth and efficient collaboration process. To get started, please refer to the Contribution Guide for detailed instructions on how to contribute to the project.
Please visit our Wiki page for a detailed overview of the project's architecture and guidelines. Explore further to gain a deeper understanding of our project.
Special thanks to the incredible code contributors who continue to drive this project forward.