Built in Python + FastAPI.
- Full loan eligibility logic
- Realistic mock Salary & Credit Bureau services
- Proper error handling & logging
- Auto-generated OpenAPI docs at
/docs
| 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 |
git clone https://github.com/MFDrey/loan-eligibility-api.git
cd loan-eligibility-api
docker-compose -f docker-compose.yml up -d95%+ coverage with pytest:
- All business rules
- Edge cases
- External service failures
- Input validation
Run with: pytest tests/ -v
- 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)
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.