A TypeScript client library for the Apache Fineract REST API, automatically generated from the OpenAPI specification.
- π Auto-generated from the latest Fineract OpenAPI specification
- π¦ TypeScript-first with full type safety
- π Axios-based HTTP client with Promise support
- π Comprehensive API coverage for all Fineract endpoints
- π― ES6+ compatible with modern JavaScript features
Download the latest release from the Releases page:
# Download and extract the TypeScript client
wget https://github.com/equalbyte/fineract-typescript-client/releases/latest/download/typescript-client-v1.0.0.zip
unzip typescript-client-v1.0.0.zipgit clone https://github.com/equalbyte/fineract-typescript-client.git
cd fineract-typescript-client
npm installimport { Configuration, DefaultApi } from './src/typescript-client';
// Configure the client
const config = new Configuration({
basePath: 'https://your-fineract-instance.com/fineract-provider/api',
username: 'your-username',
password: 'your-password',
headers: {
'Fineract-Platform-TenantId': 'your-tenant-id'
}
});
// Create API instance
const api = new DefaultApi(config);
// Example: Get all clients
async function getClients() {
try {
const response = await api.retrieveAllClients();
console.log('Clients:', response.data);
} catch (error) {
console.error('Error fetching clients:', error);
}
}
getClients();The client supports various configuration options:
const config = new Configuration({
basePath: 'https://demo.fineract.dev/fineract-provider/api',
username: 'mifos',
password: 'password',
headers: {
'Fineract-Platform-TenantId': 'default'
},
// Optional: Custom axios instance
// axios: customAxiosInstance
});You can also use environment variables for configuration:
# .env file
FINERACT_BASE_URL=https://demo.fineract.dev/fineract-provider/api
FINERACT_USERNAME=mifos
FINERACT_PASSWORD=password
FINERACT_TENANT_ID=defaultimport dotenv from 'dotenv';
dotenv.config();
const config = new Configuration({
basePath: process.env.FINERACT_BASE_URL,
username: process.env.FINERACT_USERNAME,
password: process.env.FINERACT_PASSWORD,
headers: {
'Fineract-Platform-TenantId': process.env.FINERACT_TENANT_ID
}
});// Get all clients
const clients = await api.retrieveAllClients();
// Get a specific client
const client = await api.retrieveOne(1);
// Create a new client
const newClient = await api.createClient({
firstname: 'John',
lastname: 'Doe',
dateOfBirth: '1990-01-01',
locale: 'en',
dateFormat: 'dd MMMM yyyy'
});// Get all loans
const loans = await api.retrieveAllLoans();
// Get loan details
const loan = await api.retrieveLoan(1);
// Create a new loan application
const loanApplication = await api.createLoanApplication({
clientId: 1,
productId: 1,
principal: 1000,
loanTermFrequency: 12,
loanTermFrequencyType: 2, // months
numberOfRepayments: 12,
repaymentEvery: 1,
repaymentFrequencyType: 2, // months
interestRatePerPeriod: 2.0,
locale: 'en',
dateFormat: 'dd MMMM yyyy'
});// Get savings accounts
const savingsAccounts = await api.retrieveAllSavingsAccounts();
// Get account transactions
const transactions = await api.retrieveAllTransactions(1);- Node.js 18+
- npm or yarn
- Java 8+ (for OpenAPI Generator)
-
Clone the repository:
git clone https://github.com/equalbyte/fineract-typescript-client.git cd fineract-typescript-client -
Install dependencies:
npm install
-
Run the demo:
npm run demo
The TypeScript client is automatically generated from the Fineract OpenAPI specification. You can regenerate it manually:
# Generate the client
npm run generate-typescript-client
# Or regenerate from scratch
npm run regenerate-typescript-clientThis project uses GitHub Actions to automatically generate the TypeScript client whenever a new release is created.
- Release Trigger: When you create a new release, the GitHub Actions workflow automatically runs
- Client Generation: The workflow generates the TypeScript client from the latest
fineract.jsonspecification - Repository Update: Generated changes are committed and pushed to the main branch
- Release Assets: The generated client is packaged and attached to the release as downloadable assets
- β Automatic: Runs on every release creation
- β Versioned: Each release includes the corresponding client version
- β
Assets: Downloadable
.zipand.tar.gzarchives - β Committed: Generated code is committed to the repository
- β Manual Trigger: Can be triggered manually via GitHub Actions
Each release includes:
typescript-client-v{version}.zip- ZIP archive of the generated clienttypescript-client-v{version}.tar.gz- Compressed tar archive
The generated client includes comprehensive TypeScript interfaces and JSDoc comments. You can explore the API by:
- IDE Support: Full IntelliSense and autocomplete in your IDE
- Type Definitions: All API models and responses are fully typed
- Documentation: JSDoc comments for all methods and parameters
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Apache Fineract - The microfinance platform
- OpenAPI Generator - For generating the TypeScript client
- Axios - HTTP client library
- π Fineract Documentation
- π Report Issues
- π¬ Discussions
You can test the client against the Fineract demo instance:
- URL: https://demo.fineract.dev/fineract-provider/api
- Username: mifos
- Password: password
- Tenant ID: default