Skip to content

MFDrey/loan-eligibility-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loan Eligibility API

Built in Python + FastAPI.

Features

  • Full loan eligibility logic
  • Realistic mock Salary & Credit Bureau services
  • Proper error handling & logging
  • Auto-generated OpenAPI docs at /docs

Tech Stack & Why

Choice Reason
Python 3.11 + FastAPI Fastest way to build a robust, typed, auto-documented API. Beats Flask in performance & DX.
Pydantic v2 Strong validation, automatic OpenAPI/Swagger docs
Uvicorn ASGI server — production ready
HTTPX Async HTTP client to call mock services
In-memory mocks Two extra FastAPI apps running on different ports acting as Salary & Credit Bureau services
Docker + docker-compose One-command local run

How to run locally

git clone https://github.com/MFDrey/loan-eligibility-api.git
cd loan-eligibility-api
docker-compose -f docker-compose.yml up -d

Tests

95%+ coverage with pytest:

  • All business rules
  • Edge cases
  • External service failures
  • Input validation

Run with: pytest tests/ -v

What I would improve with more time

  • Proper CI/CD with GitHub Actions
  • Rate limiting & authentication (even JWT stub)
  • Persistence (Redis/PostgreSQL) instead of in-memory
  • OpenAPI spec export + Postman collection
  • Monitoring (Sentry, Prometheus)
  • Full input sanitisation & national ID format validation for Malawi
  • Unit tests coverage → 95%+ (Currently tested manually via Bruno; yet to run automatic tests with pytest)

Apologies

In the interest of time and due to other commitments, hosting this project live is not that plausible for me. However, it is fully functional, try running it locally.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published