Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

getcorefin/corefin

Repository files navigation

image

Open-Source Lending Infrastructure

Corefin is a highly scalable open-source loan management system that allows you to build and launch lending products. It uses the Actual/365 method for calculating interest. See information from the CFPB.

Getting started

Quick demo

Here's a demo on creating a loan, making a payment, and seeing all installments.

demo.mp4

Prerequisites

  1. Make sure you have Docker installed on your machine.
  2. Make sure you have Java17 installed on your machine.

To install Java17, run the following commands in the shell:

# Install Java17
brew install openjdk@17

# Check which Java versions you have installed
/usr/libexec/java_home -V

# Set your java version to Java17
export JAVA_HOME=$(/usr/libexec/java_home -v 17.0.10)

Running locally

To start running Corefin, run the commands in the shell:

# Get the code
git clone https://github.com/getcorefin/corefin.git

# Go to the folder
cd corefin

# Create docker stubs
make docker-stubs

# Perform DB migrations
make db-migrate

# Start
make run-server

Using Corefin

Create a loan

Here's an example of creating a 6 month term loan for $1000 at a 5% target interest rate.

curl --location 'http://localhost:8080/loans' \
--header 'Content-Type: application/json' \
--data '{
    "term": 6,
    "originatedAmount": 1000.00,
    "currency": "USD",
    "targetInterestRate": 0.05,
    "effectiveInterestRate": 0.05,
    "externalReference": "orderId_12345",
    "startDate": "2024-03-01",
    "endDate": "2024-09-01",
    "timezone": "America/Los_Angeles",
    "region": "US",
    "state": "CA"
}'

Make a payment

curl --location 'http://localhost:8080/payments/$LOAN_ID/makePayment' \
--header 'Content-Type: application/json' \
--data '{
    "amount": "171.56",
    "paymentType": "PAYMENT",
    "paymentDateTime" : "2024-03-01T12:00:00Z"
}'

View the installment schedule

# Connect to the DB
make db-shell

# Execute the following SQL
mysql> select loan_installment_id, num_term, principal_amount, interest_amount from loan_installment where loan_id="132b124a-e247-11ee-bf07-0242ac140002";
+--------------------------------------+----------+------------------+-----------------+
| loan_installment_id                  | num_term | principal_amount | interest_amount |
+--------------------------------------+----------+------------------+-----------------+
| 132b124a-e247-11ee-bf07-0242ac140002 |        1 |           129.62 |          424.66 |
| 132d3525-e247-11ee-bf07-0242ac140002 |        2 |           196.59 |          357.69 |
| 132e2291-e247-11ee-bf07-0242ac140002 |        3 |           268.15 |          286.13 |
| 132eab9b-e247-11ee-bf07-0242ac140002 |        4 |           405.64 |          166.70 |

Roadmap

Check out our public roadmap for a more detailed view.

At a high level, we're working on the following features next:

  • Early/on-time/late payments
  • Custom installment amount payments
  • Support for other lending products such as MCAs
  • Robust reporting API

... and many more!

Corefin community

Contributions and development environment

Coming soon!