Giter VIP home page Giter VIP logo

loan-management-app's Introduction

Loan Management App

Idea Structure for North star view reference.

HLD

Tech Stack

Recommended Microservices Architecture

Microservice Recommended Type Recommended Framework Reason
Authentication Service Serverless or Auto-Scaling Pods Node.js or Python - Serverless is cost-effective for sporadic usage.
- Node.js and Python have strong libraries for authentication.
Loan Management Service Auto-Scaling Pods Java or Node.js - Java is robust for financial calculations.
- Node.js for easier JSON manipulation.
Admin Approval Service Serverless Python or Node.js - Serverless for cost-effectiveness.
- Python and Node.js for quick development.
Payment Service Auto-Scaling Pods Java or Python - Java for robustness and financial calculations.
- Python for quick integration with payment gateways.

Database Choice

Ideally Postgresql should be the primary database for Loan Management service. However as the product is just getting started MongoDb is the recommended choice. Reasons are listed below.

Flexibility: MongoDB is schema-less, which means you can easily add fields like customer behavior, preferences, or other metrics without affecting existing data. This is useful for systems where the data model might evolve over time.

Scalability: If your app grows and you collect more data for loans, schemes, payments etc, MongoDB can scale horizontally easily.

Performance: For read-heavy operations like getScheduledRepayments, Loans etc, MongoDB can be faster as it allows for data denormalization and in-memory storage.

Complex Queries: MongoDB supports complex queries and aggregations, which could be useful for generating recommendations based on multiple factors.

Current stack

Current stack is Node.js, Express & MongoDb.

Current ER Model

diagram-export-16_09_2023, 03_04_59

Manual Installation

Install the dependencies:

npm install 

Set the environment variables:

cp .env.example .env

## Commands

Running locally:
```bash
npm run dev

Running in production:

npm run start

Environment Variables

The environment variables can be found and modified in the .env file. They come with these default values:

# Port number
PORT=3000

# URL of the Mongo DB
MONGODB_URL=mongodb://127.0.0.1:27017/node-boilerplate

# JWT
# JWT secret key
JWT_SECRET=thisisasamplesecret
# Number of minutes after which an access token expires
JWT_ACCESS_EXPIRATION_MINUTES=30
# Number of days after which a refresh token expires
JWT_REFRESH_EXPIRATION_DAYS=30

# SMTP configuration options for the email service
# For testing, you can use a fake SMTP service like Ethereal: https://ethereal.email/create
SMTP_HOST=email-server
SMTP_PORT=587
SMTP_USERNAME=email-server-username
SMTP_PASSWORD=email-server-password
[email protected]

Project Structure

src\
 |--config\         # Environment variables and configuration related things
 |--controllers\    # Route controllers (controller layer)
 |--docs\           # Swagger files
 |--middlewares\    # Custom express middlewares
 |--models\         # Mongoose models (data layer)
 |--routes\         # Routes
 |--services\       # Business logic (service layer)
 |--utils\          # Utility classes and functions
 |--validations\    # Request data validation schemas
 |--app.js          # Express app
 |--index.js        # App entry point

API Endpoints

List of available routes: https://winter-eclipse-878966.postman.co/workspace/Rupeek~d142949e-ea53-4bad-ba43-528785dd9e28/collection/2553501-14792e3b-38c9-4b2d-b9aa-6d64ce9ba47c?action=share&creator=2553501

Auth routes:
POST /v1/auth/register - register
POST /v1/auth/login - login
POST /v1/auth/refresh-tokens - refresh auth tokens
POST /v1/auth/forgot-password - send reset password email
POST /v1/auth/reset-password - reset password
POST /v1/auth/send-verification-email - send verification email
POST /v1/auth/verify-email - verify email

User routes:
POST /v1/users - create a user
GET /v1/users - get all users
GET /v1/users/:userId - get user
PATCH /v1/users/:userId - update user
DELETE /v1/users/:userId - delete user

Loan routes:
POST /v1/loans - create a Loan
GET /v1/loans - get all Loans
GET /v1/loans/:loanId - get loan
PATCH /v1/loans/:loadId - update loan\

Scheme routes:
POST /v1/schemes - create a scheme
GET /v1/schemes - get all Schemes\

Repayment routes:
POST /v1/repayments/:loanId - create a Repayment for given Loan
GET /v1/repayments/:loanId - get all Repayments for given Loan\

Tests

Skipped due to time limit

Note

Node architechture inspired from https://github.com/hagopj13/node-express-boilerplate

License

MIT

loan-management-app's People

Contributors

rtotala avatar rohit-totala avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.