# mothibimalebana/mbuzi-tshena-lms architecture

> Architecture diagram of the GitHub repository mothibimalebana/mbuzi-tshena-lms, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mothibimalebana/mbuzi-tshena-lms
- Repository: https://github.com/mothibimalebana/mbuzi-tshena-lms

## Overview

Mbudzi Tshena is a microfinance loan-management system with borrower and administrator interfaces backed by a FastAPI service. The user-facing journey covers account access, loan application, review, and repayment tracking; administrators also manage borrowers, payment proofs, investments, and chatbot content. The backend includes risk assessment, document handling, and notifications. The README describes the product but gives no workflow details; source-index references support backend module relationships, while frontend-to-API requests were not shown, so that connection is left unasserted.

Main entry points: [`backend/app/main.py`](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/main.py) (FastAPI service), [`src/app/pages/DashboardLayout.tsx`](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/DashboardLayout.tsx) (Admin workspace), [`backend/app/routers/payments.py`](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/payments.py) (Payment handling), [`src/app/routes.tsx`](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/routes.tsx) (Page routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Borrower experience"]
  node_browser["Web application<br/>[App.tsx]"]
  node_routing["Page routing<br/>[routes.tsx]"]
  node_login["Borrower login<br/>[UserLogin.tsx]"]
  node_dashboard["Borrower dashboard<br/>[UserDashboard.tsx]"]
  node_application["Loan application"]
  node_confirmation["Loan confirmation"]
end

subgraph group_admin["Administration"]
  node_adminlogin["Admin login<br/>[AdminLogin.tsx]"]
  node_adminlayout["Admin workspace"]
  node_overview["Admin overview"]
  node_loanreview["Loan review<br/>[LoanRequests.tsx]"]
  node_borrowers["Borrower management<br/>[BorrowersList.tsx]"]
  node_paymentview["Payment tracking"]
  node_proofview["Payment proofs"]
  node_investorview["Investor requests"]
  node_chatadmin["Chatbot questions"]
end

subgraph group_api["API and identity"]
  node_api["FastAPI service<br/>[main.py]"]
  node_identity["Identity and access<br/>[auth.py]"]
  node_authroutes["Authentication routes<br/>[auth.py]"]
  node_contracts["Request schemas<br/>[schemas.py]"]
  node_store[("Relational database<br/>[database.py]")]
  node_domain["Loan domain records<br/>[models.py]"]
end

subgraph group_lending["Lending operations"]
  node_applications["Application handling<br/>[applications.py]"]
  node_payments["Payment handling<br/>[payments.py]"]
  node_proofs["Proof verification<br/>[proofs.py]"]
  node_documents["Document handling<br/>[documents.py]"]
  node_investments["Investment handling<br/>[investments.py]"]
  node_adminroutes["Admin operations<br/>[admin.py]"]
end

subgraph group_support["Risk and services"]
  node_notifications["Notifications<br/>[notifications.py]"]
  node_chatroute["Chatbot service<br/>[chatbot.py]"]
  node_risk["Risk assessment<br/>[risk_assessment.py]"]
  node_riskscore["Risk scoring<br/>[risk_score.py]"]
  node_balance["Loan balance<br/>[loan_balance.py]"]
  node_reliability["Repayment reliability<br/>[reliability.py]"]
end

node_borrower(("Borrower"))

node_borrower -->|"uses"| node_routing
node_browser -->|"provides routes"| node_routing
node_routing -->|"routes to"| node_login
node_routing -->|"routes to"| node_dashboard
node_routing -->|"routes to"| node_application
node_routing -->|"routes to"| node_confirmation
node_routing -->|"routes to"| node_adminlogin
node_routing -->|"routes to"| node_adminlayout
node_adminlayout -->|"contains route"| node_overview
node_adminlayout -->|"contains route"| node_loanreview
node_adminlayout -->|"contains route"| node_borrowers
node_adminlayout -->|"contains route"| node_paymentview
node_adminlayout -->|"contains route"| node_proofview
node_adminlayout -->|"contains route"| node_investorview
node_adminlayout -->|"contains route"| node_chatadmin
node_api -->|"mounts"| node_authroutes
node_api -->|"mounts"| node_applications
node_api -->|"mounts"| node_payments
node_api -->|"mounts"| node_adminroutes
node_api -->|"mounts"| node_documents
node_api -->|"mounts"| node_notifications
node_api -->|"mounts"| node_proofs
node_api -->|"mounts"| node_investments
node_api -->|"mounts"| node_chatroute
node_authroutes -->|"uses"| node_identity
node_authroutes -->|"queries"| node_store
node_authroutes -->|"uses schemas"| node_contracts
node_applications -->|"assesses"| node_risk
node_applications -->|"queries"| node_store
node_applications -->|"uses records"| node_domain
node_applications -->|"checks access"| node_identity
node_applications -->|"uses schemas"| node_contracts
node_payments -->|"queries"| node_store
node_payments -->|"uses records"| node_domain
node_payments -->|"checks access"| node_identity
node_payments -->|"updates balance"| node_balance
node_payments -->|"updates reliability"| node_reliability
node_payments -->|"uses score"| node_riskscore
node_proofs -->|"references"| node_payments
node_proofs -->|"queries"| node_store
node_proofs -->|"uses records"| node_domain
node_proofs -->|"uses balance"| node_balance
node_proofs -->|"uses reliability"| node_reliability
node_documents -->|"queries"| node_store
node_documents -->|"uses records"| node_domain
node_investments -->|"queries"| node_store
node_investments -->|"uses records"| node_domain
node_adminroutes -->|"queries"| node_store

click node_browser "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/App.tsx"
click node_routing "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/routes.tsx"
click node_login "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/UserLogin.tsx"
click node_dashboard "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/UserDashboard.tsx"
click node_application "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/LoanApplication.tsx"
click node_confirmation "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/LoanConfirmation.tsx"
click node_adminlogin "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/AdminLogin.tsx"
click node_adminlayout "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/DashboardLayout.tsx"
click node_overview "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/DashboardOverview.tsx"
click node_loanreview "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/LoanRequests.tsx"
click node_borrowers "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/BorrowersList.tsx"
click node_paymentview "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/PaymentsTracker.tsx"
click node_proofview "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/ProofOfPayments.tsx"
click node_investorview "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/InvestorRequests.tsx"
click node_chatadmin "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/ChatbotQuestions.tsx"
click node_api "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/main.py"
click node_identity "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/auth.py"
click node_authroutes "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/auth.py"
click node_contracts "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/schemas.py"
click node_store "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/database.py"
click node_domain "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/models.py"
click node_applications "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/applications.py"
click node_payments "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/payments.py"
click node_proofs "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/proofs.py"
click node_documents "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/documents.py"
click node_investments "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/investments.py"
click node_adminroutes "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/admin.py"
click node_notifications "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/notifications.py"
click node_chatroute "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/chatbot.py"
click node_risk "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/utils/risk_assessment.py"
click node_riskscore "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/utils/risk_score.py"
click node_balance "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/utils/loan_balance.py"
click node_reliability "https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/utils/reliability.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_routing,node_login,node_dashboard,node_application,node_confirmation toneBlue
class node_adminlogin,node_adminlayout,node_overview,node_loanreview,node_borrowers,node_paymentview,node_proofview,node_investorview,node_chatadmin toneAmber
class node_api,node_identity,node_authroutes,node_contracts,node_store,node_domain toneMint
class node_applications,node_payments,node_proofs,node_documents,node_investments,node_adminroutes toneRose
class node_notifications,node_chatroute,node_risk,node_riskscore,node_balance,node_reliability,node_borrower toneIndigo
```

## Components

### Borrower experience

- [Web application](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Page routing](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/routes.tsx): `src/app/routes.tsx`
- [Borrower login](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/UserLogin.tsx): `src/app/pages/UserLogin.tsx`
- [Borrower dashboard](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/UserDashboard.tsx): `src/app/pages/UserDashboard.tsx`
- [Loan application](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/LoanApplication.tsx): `src/app/pages/LoanApplication.tsx`
- [Loan confirmation](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/LoanConfirmation.tsx): `src/app/pages/LoanConfirmation.tsx`

### Administration

- [Admin login](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/AdminLogin.tsx): `src/app/pages/AdminLogin.tsx`
- [Admin workspace](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/DashboardLayout.tsx): `src/app/pages/DashboardLayout.tsx`
- [Admin overview](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/DashboardOverview.tsx): `src/app/pages/DashboardOverview.tsx`
- [Loan review](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/LoanRequests.tsx): `src/app/pages/LoanRequests.tsx`
- [Borrower management](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/BorrowersList.tsx): `src/app/pages/BorrowersList.tsx`
- [Payment tracking](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/PaymentsTracker.tsx): `src/app/pages/PaymentsTracker.tsx`
- [Payment proofs](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/ProofOfPayments.tsx): `src/app/pages/ProofOfPayments.tsx`
- [Investor requests](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/InvestorRequests.tsx): `src/app/pages/InvestorRequests.tsx`
- [Chatbot questions](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/src/app/pages/ChatbotQuestions.tsx): `src/app/pages/ChatbotQuestions.tsx`

### API and identity

- [FastAPI service](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/main.py): `backend/app/main.py`
- [Identity and access](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/auth.py): `backend/app/auth.py`
- [Authentication routes](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Request schemas](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Relational database](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/database.py): `backend/app/database.py`
- [Loan domain records](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/models.py): `backend/app/models.py`

### Lending operations

- [Application handling](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/applications.py): `backend/app/routers/applications.py`
- [Payment handling](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/payments.py): `backend/app/routers/payments.py`
- [Proof verification](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/proofs.py): `backend/app/routers/proofs.py`
- [Document handling](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/documents.py): `backend/app/routers/documents.py`
- [Investment handling](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/investments.py): `backend/app/routers/investments.py`
- [Admin operations](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/admin.py): `backend/app/routers/admin.py`

### Risk and services

- [Notifications](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/notifications.py): `backend/app/routers/notifications.py`
- [Chatbot service](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/routers/chatbot.py): `backend/app/routers/chatbot.py`
- [Risk assessment](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/utils/risk_assessment.py): `backend/app/utils/risk_assessment.py`
- [Risk scoring](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/utils/risk_score.py): `backend/app/utils/risk_score.py`
- [Loan balance](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/utils/loan_balance.py): `backend/app/utils/loan_balance.py`
- [Repayment reliability](https://github.com/mothibimalebana/mbuzi-tshena-lms/blob/main/backend/app/utils/reliability.py): `backend/app/utils/reliability.py`

### Other components

- **Borrower**

## Connections

- Borrower → Page routing: uses (evidence: `src/app/routes.tsx`)
- Web application → Page routing: provides routes (evidence: `src/app/App.tsx`)
- Page routing → Borrower login: routes to (evidence: `src/app/routes.tsx`)
- Page routing → Borrower dashboard: routes to (evidence: `src/app/routes.tsx`)
- Page routing → Loan application: routes to (evidence: `src/app/routes.tsx`)
- Page routing → Loan confirmation: routes to (evidence: `src/app/routes.tsx`)
- Page routing → Admin login: routes to (evidence: `src/app/routes.tsx`)
- Page routing → Admin workspace: routes to (evidence: `src/app/routes.tsx`)
- Admin workspace → Admin overview: contains route (evidence: `src/app/routes.tsx`)
- Admin workspace → Loan review: contains route (evidence: `src/app/routes.tsx`)
- Admin workspace → Borrower management: contains route (evidence: `src/app/routes.tsx`)
- Admin workspace → Payment tracking: contains route (evidence: `src/app/routes.tsx`)
- Admin workspace → Payment proofs: contains route (evidence: `src/app/routes.tsx`)
- Admin workspace → Investor requests: contains route (evidence: `src/app/routes.tsx`)
- Admin workspace → Chatbot questions: contains route (evidence: `src/app/routes.tsx`)
- FastAPI service → Authentication routes: mounts (evidence: `backend/app/main.py`)
- FastAPI service → Application handling: mounts (evidence: `backend/app/main.py`)
- FastAPI service → Payment handling: mounts (evidence: `backend/app/main.py`)
- FastAPI service → Admin operations: mounts (evidence: `backend/app/main.py`)
- FastAPI service → Document handling: mounts (evidence: `backend/app/main.py`)
- FastAPI service → Notifications: mounts (evidence: `backend/app/main.py`)
- FastAPI service → Proof verification: mounts (evidence: `backend/app/main.py`)
- FastAPI service → Investment handling: mounts (evidence: `backend/app/main.py`)
- FastAPI service → Chatbot service: mounts (evidence: `backend/app/main.py`)
- Authentication routes → Identity and access: uses (evidence: `backend/app/routers/auth.py`)
- Authentication routes → Relational database: queries (evidence: `backend/app/routers/auth.py`)
- Authentication routes → Request schemas: uses schemas (evidence: `backend/app/routers/auth.py`)
- Application handling → Risk assessment: assesses (evidence: `backend/app/routers/applications.py`)
- Application handling → Relational database: queries (evidence: `backend/app/routers/applications.py`)
- Application handling → Loan domain records: uses records (evidence: `backend/app/routers/applications.py`)
- Application handling → Identity and access: checks access (evidence: `backend/app/routers/applications.py`)
- Application handling → Request schemas: uses schemas (evidence: `backend/app/routers/applications.py`)
- Payment handling → Relational database: queries (evidence: `backend/app/routers/payments.py`)
- Payment handling → Loan domain records: uses records (evidence: `backend/app/routers/payments.py`)
- Payment handling → Identity and access: checks access (evidence: `backend/app/routers/payments.py`)
- Payment handling → Loan balance: updates balance (evidence: `backend/app/routers/payments.py`)
- Payment handling → Repayment reliability: updates reliability (evidence: `backend/app/routers/payments.py`)
- Payment handling → Risk scoring: uses score (evidence: `backend/app/routers/payments.py`)
- Proof verification → Payment handling: references (evidence: `backend/app/routers/proofs.py`)
- Proof verification → Relational database: queries (evidence: `backend/app/routers/proofs.py`)
- Proof verification → Loan domain records: uses records (evidence: `backend/app/routers/proofs.py`)
- Proof verification → Loan balance: uses balance (evidence: `backend/app/routers/proofs.py`)
- Proof verification → Repayment reliability: uses reliability (evidence: `backend/app/routers/proofs.py`)
- Document handling → Relational database: queries (evidence: `backend/app/routers/documents.py`)
- Document handling → Loan domain records: uses records (evidence: `backend/app/routers/documents.py`)
- Investment handling → Relational database: queries (evidence: `backend/app/routers/investments.py`)
- Investment handling → Loan domain records: uses records (evidence: `backend/app/routers/investments.py`)
- Admin operations → Relational database: queries (evidence: `backend/app/routers/admin.py`)
