# mehboobali-portfolio/micro-lending-app architecture

> Architecture diagram of the GitHub repository mehboobali-portfolio/micro-lending-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mehboobali-portfolio/micro-lending-app
- Repository: https://github.com/mehboobali-portfolio/micro-lending-app

## Overview

Micro Lending App is a full-stack invoice and payment-link application. Finance managers register or sign in, manage searchable invoices, and generate expiring links; customers use a public page to review and confirm payment. Flask routes own backend operations, SQLite stores users, customers, invoices, and links, and confirmation dispatches payment notifications. The React app selects the manager or public-payment interface and calls the API. Backend and frontend source excerpts support the principal calls; broader capabilities are included where documented, with no unverified subsystem links added.

Main entry points: [`backend/app.py`](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/app.py) (Flask app), [`frontend/src/App.jsx`](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/App.jsx) (App routing), [`backend/database.py`](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/database.py) (Database manager), [`frontend/src/services/api.js`](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_login["Register and login<br/>[Login.jsx]"]
  node_dashboard["Invoice dashboard<br/>[Dashboard.jsx]"]
  node_payui["Payment page<br/>[PayInvoice.jsx]"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_backend["Flask API"]
  node_server["Flask app<br/>[app.py]"]
  node_auth["Authentication routes<br/>[auth.py]"]
  node_invoices["Invoice routes<br/>[invoices.py]"]
  node_publicpay["Public payment routes<br/>[public_pay.py]"]
end

subgraph group_domain["Invoice and payment domain"]
  node_linkfactory["Payment link factory"]
  node_observers["Payment observers"]
end

subgraph group_storage["Persistence"]
  node_dbmanager["Database manager<br/>[database.py]"]
  node_sqlite[("SQLite database<br/>[database.db]")]
end

node_manager(("Finance manager"))
node_customer(("Customer"))

node_manager -->|"uses portal"| node_app
node_customer -->|"opens payment"| node_app
node_app -->|"renders"| node_login
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_payui
node_login -->|"calls"| node_api
node_dashboard -->|"calls"| node_api
node_payui -->|"calls"| node_api
node_api -.->|"HTTP requests"| node_server
node_server -->|"initializes"| node_dbmanager
node_server -->|"registers routes"| node_auth
node_server -->|"registers routes"| node_invoices
node_server -->|"registers routes"| node_publicpay
node_auth -->|"reads and writes"| node_dbmanager
node_invoices -->|"reads and writes"| node_dbmanager
node_invoices -->|"creates links"| node_linkfactory
node_publicpay -->|"reads and writes"| node_dbmanager
node_publicpay -->|"notifies"| node_observers
node_dbmanager -->|"stores records"| node_sqlite

click node_app "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/components/Login.jsx"
click node_dashboard "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/components/Dashboard.jsx"
click node_payui "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/components/PayInvoice.jsx"
click node_api "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/services/api.js"
click node_server "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/app.py"
click node_auth "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/routes/auth.py"
click node_invoices "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/routes/invoices.py"
click node_publicpay "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/routes/public_pay.py"
click node_linkfactory "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/factories/payment_link_factory.py"
click node_observers "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/observers/payment_observer.py"
click node_dbmanager "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/database.py"
click node_sqlite "https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/database.db"

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_app,node_login,node_dashboard,node_payui,node_api toneBlue
class node_server,node_auth,node_invoices,node_publicpay toneAmber
class node_linkfactory,node_observers toneMint
class node_dbmanager,node_sqlite toneRose
class node_manager,node_customer toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Register and login](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/components/Login.jsx): `frontend/src/components/Login.jsx`
- [Invoice dashboard](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/components/Dashboard.jsx): `frontend/src/components/Dashboard.jsx`
- [Payment page](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/components/PayInvoice.jsx): `frontend/src/components/PayInvoice.jsx`
- [API client](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Flask API

- [Flask app](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/app.py): `backend/app.py`
- [Authentication routes](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Invoice routes](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/routes/invoices.py): `backend/routes/invoices.py`
- [Public payment routes](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/routes/public_pay.py): `backend/routes/public_pay.py`

### Invoice and payment domain

- [Payment link factory](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/factories/payment_link_factory.py): `backend/factories/payment_link_factory.py`
- [Payment observers](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/observers/payment_observer.py): `backend/observers/payment_observer.py`

### Persistence

- [Database manager](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/database.py): `backend/database.py`
- [SQLite database](https://github.com/mehboobali-portfolio/micro-lending-app/blob/main/backend/database.db): `backend/database.db`

### Other components

- **Finance manager**
- **Customer**

## Connections

- Finance manager → App routing: uses portal (evidence: `README.md`)
- Customer → App routing: opens payment (evidence: `README.md`)
- App routing → Register and login: renders (evidence: `frontend/src/App.jsx`)
- App routing → Invoice dashboard: renders (evidence: `frontend/src/App.jsx`)
- App routing → Payment page: renders (evidence: `frontend/src/App.jsx`)
- Register and login → API client: calls (evidence: `frontend/src/components/Login.jsx`)
- Invoice dashboard → API client: calls (evidence: `frontend/src/components/Dashboard.jsx`)
- Payment page → API client: calls (evidence: `frontend/src/components/PayInvoice.jsx`)
- API client → Flask app: HTTP requests
- Flask app → Database manager: initializes (evidence: `backend/app.py`)
- Flask app → Authentication routes: registers routes (evidence: `backend/app.py`)
- Flask app → Invoice routes: registers routes (evidence: `backend/app.py`)
- Flask app → Public payment routes: registers routes (evidence: `backend/app.py`)
- Authentication routes → Database manager: reads and writes (evidence: `backend/routes/auth.py`)
- Invoice routes → Database manager: reads and writes (evidence: `backend/routes/invoices.py`)
- Invoice routes → Payment link factory: creates links (evidence: `backend/routes/invoices.py`)
- Public payment routes → Database manager: reads and writes (evidence: `backend/routes/public_pay.py`)
- Public payment routes → Payment observers: notifies (evidence: `backend/routes/public_pay.py`)
- Database manager → SQLite database: stores records (evidence: `backend/database.py`)
