Alternative credit scoring for MSMEs in Africa using mobile money & behavioral data โ Supabase + FastAPI + ML
# ๐ MSME Alternative Credit Scoring โ Africa
> Real-time credit scoring API for micro/small businesses in Africa using **alternative data** (mobile money, behavioral signals) โ because **80% of MSMEs are unbanked** and excluded from traditional credit.
## Problem
Traditional credit scoring requires: bank statements, tax records, collateral, credit history.
In Sub-Saharan Africa, **60-80% of adults lack formal banking** โ but they do have:
- ๐ฑ Mobile money history (Wave, M-Pesa, Orange Money, MoMo)
- ๐ Telecom behavioral data
- ๐ E-commerce transaction history
- ๐ Geolocation patterns
## API โ Score a Business in Real-Time
```bash
curl -X POST
api.your-domain.com -H "Content-Type: application/json" -d '{
"business_id": "BIZ-001",
"country_code": "SN",
"sector": "retail",
"years_in_operation": 2.5,
"monthly_revenue_usd": 800,
"requested_amount_usd": 1500,
"loan_purpose": "inventory",
"mobile_money": {
"total_transactions_90d": 45,
"total_volume_usd_90d": 3200,
"has_regular_income": true
}
}'
```
**Response:**
```json
{
"credit_score": 680,
"risk_band": "B",
"decision": "approved",
"max_loan_amount_usd": 1500,
"recommended_rate_pct": 12.0,
"explanation": [
"โ
High mobile money activity โ strong financial engagement",
"โ
Business established for 2.5 years",
"โ
Regular income pattern detected"
]
}
```
## Stack
```
FastAPI โ REST API (scoring endpoint, <100ms latency)
Supabase โ PostgreSQL + RLS + real-time audit log
LightGBM โ ML scoring model (trained on historical repayment data)
dbt โ Feature engineering from raw transactions
```
## Countries Supported
Senegal ๐ธ๐ณ ยท Cรดte d'Ivoire ๐จ๐ฎ ยท Nigeria ๐ณ๐ฌ ยท Kenya ๐ฐ๐ช ยท Ghana ๐ฌ๐ญ ยท Cameroon ๐จ๐ฒ
## Setup
```bash
pip install -r requirements.txt
cp .env.example .env # Add SUPABASE_URL, SUPABASE_KEY
supabase db push # Apply migrations
uvicorn app.main:app --reload
```
## Author
**Ibrahima Gabar Diop** โ GitHub ยท Kaggle