# iandolalaina/microfinnance architecture

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

- Interactive diagram: https://gitdiagram.com/iandolalaina/microfinnance
- Repository: https://github.com/iandolalaina/microfinnance

## Overview

This is a Laravel cooperative-finance application: members request savings accounts or loans, agents review requests, and members make deposits or repayments. The documented savings flow includes MVola confirmation, private PDF receipts, withdrawals, and notifications; the loan code supports group-backed requests, review, schedules, and payment application. The README also describes targeted announcements and Web Push. The graph uses the supplied excerpts, source-index references, and README; unverified review and notification dispatch links are dashed rather than asserted.

Main entry points: [`app/Services/PaymentConfirmationService.php`](https://github.com/iandolalaina/microfinnance/blob/main/app/Services/PaymentConfirmationService.php) (Payment confirmation), [`app/Models/Payment.php`](https://github.com/iandolalaina/microfinnance/blob/main/app/Models/Payment.php) (Payments and schedules), [`app/Livewire/ClientDepositRequest.php`](https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ClientDepositRequest.php) (Savings requests), [`app/Livewire/AgentDepositReview.php`](https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/AgentDepositReview.php) (Account and withdrawal review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Member access"]
  node_auth["Login and registration"]
  node_client_dashboard["Client dashboard"]
end

subgraph group_savings["Savings payments"]
  node_deposit_request["Savings requests"]
  node_deposit_review["Account and withdrawal review"]
  node_mvola_adapter["MVola adapter"]
  node_webhook["MVola webhook"]
  node_confirmation["Payment confirmation"]
  node_receipt["Receipt download"]
end

subgraph group_loans["Loan servicing"]
  node_loan_request["Loan request"]
  node_loan_review["Loan review"]
  node_loan_rules["Loan calculations<br/>[LoanService.php]"]
  node_loan_payment["Loan payments"]
end

subgraph group_communications["Member communications"]
  node_announcement["Announcements"]
  node_push_subscription["Push subscriptions"]
  node_sms_listener["Payment SMS listener"]
end

subgraph group_domain["Finance records"]
  node_payment_records[("Payments and schedules<br/>[Payment.php]")]
  node_savings_records[("Savings accounts<br/>[SavingsAccount.php]")]
  node_loan_records[("Loans and schedules<br/>[Loan.php]")]
  node_member_records[("Users and groups<br/>[User.php]")]
  node_payment_event["Payment received event"]
end

node_member(("Member"))
node_agent(("Agent"))
node_mvola(("MVola"))
node_push_network(("Push service"))

node_member -->|"signs in"| node_auth
node_agent -->|"signs in"| node_auth
node_member -->|"views activity"| node_client_dashboard
node_member -->|"requests savings"| node_deposit_request
node_deposit_request -->|"creates and reads"| node_savings_records
node_deposit_request -->|"creates payments"| node_payment_records
node_deposit_request -->|"starts deposit"| node_mvola_adapter
node_mvola_adapter -.->|"initiates payment"| node_mvola
node_mvola -->|"sends callback"| node_webhook
node_webhook -->|"looks up payment"| node_payment_records
node_webhook -->|"confirms payment"| node_confirmation
node_confirmation -->|"updates payment"| node_payment_records
node_confirmation -->|"applies loan payment"| node_loan_records
node_confirmation -->|"dispatches event"| node_payment_event
node_confirmation -.->|"stores receipt"| node_receipt
node_member -->|"downloads receipt"| node_receipt
node_agent -->|"reviews requests"| node_deposit_review
node_deposit_review -.->|"approves accounts"| node_savings_records
node_deposit_review -.->|"records withdrawals"| node_payment_records
node_member -.->|"requests loan"| node_loan_request
node_loan_request -->|"reads loan options"| node_loan_records
node_loan_request -->|"submits loan"| node_loan_rules
node_loan_rules -->|"creates schedules"| node_loan_records
node_agent -.->|"reviews loan"| node_loan_review
node_loan_review -.->|"processes review"| node_loan_rules
node_member -.->|"makes repayment"| node_loan_payment
node_loan_payment -.->|"records payment"| node_payment_records
node_payment_event -->|"triggers listener"| node_sms_listener
node_agent -->|"publishes notice"| node_announcement
node_announcement -->|"delivers notice"| node_member
node_member -->|"enables notifications"| node_push_subscription
node_push_subscription -.->|"registers endpoint"| node_push_network
node_announcement -->|"sends push"| node_push_network
node_push_subscription -->|"stores subscription"| node_member_records

click node_auth "https://github.com/iandolalaina/microfinnance/tree/main/app/Http/Controllers/Auth"
click node_client_dashboard "https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ClientDashboard.php"
click node_deposit_request "https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ClientDepositRequest.php"
click node_deposit_review "https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/AgentDepositReview.php"
click node_mvola_adapter "https://github.com/iandolalaina/microfinnance/tree/main/app/Services/Mvola"
click node_webhook "https://github.com/iandolalaina/microfinnance/blob/main/app/Http/Controllers/Api/MvolaWebhookController.php"
click node_confirmation "https://github.com/iandolalaina/microfinnance/blob/main/app/Services/PaymentConfirmationService.php"
click node_receipt "https://github.com/iandolalaina/microfinnance/blob/main/app/Http/Controllers/ReceiptController.php"
click node_loan_request "https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ClientLoanRequest.php"
click node_loan_review "https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/LoanRequestReview.php"
click node_loan_rules "https://github.com/iandolalaina/microfinnance/blob/main/app/Services/LoanService.php"
click node_loan_payment "https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ManualLoanPayment.php"
click node_announcement "https://github.com/iandolalaina/microfinnance/blob/main/app/Services/AnnouncementDeliveryService.php"
click node_push_subscription "https://github.com/iandolalaina/microfinnance/blob/main/app/Http/Controllers/PushSubscriptionController.php"
click node_payment_records "https://github.com/iandolalaina/microfinnance/blob/main/app/Models/Payment.php"
click node_savings_records "https://github.com/iandolalaina/microfinnance/blob/main/app/Models/SavingsAccount.php"
click node_loan_records "https://github.com/iandolalaina/microfinnance/blob/main/app/Models/Loan.php"
click node_member_records "https://github.com/iandolalaina/microfinnance/blob/main/app/Models/User.php"
click node_payment_event "https://github.com/iandolalaina/microfinnance/blob/main/app/Events/PaymentReceived.php"
click node_sms_listener "https://github.com/iandolalaina/microfinnance/blob/main/app/Listeners/SendPaymentReceivedSms.php"

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_auth,node_client_dashboard toneBlue
class node_deposit_request,node_deposit_review,node_mvola_adapter,node_webhook,node_confirmation,node_receipt toneAmber
class node_loan_request,node_loan_review,node_loan_rules,node_loan_payment toneMint
class node_announcement,node_push_subscription,node_sms_listener toneRose
class node_payment_records,node_savings_records,node_loan_records,node_member_records,node_payment_event,node_member,node_agent,node_mvola,node_push_network toneIndigo
```

## Components

### Member access

- [Login and registration](https://github.com/iandolalaina/microfinnance/tree/main/app/Http/Controllers/Auth): `app/Http/Controllers/Auth`
- [Client dashboard](https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ClientDashboard.php): `app/Livewire/ClientDashboard.php`

### Savings payments

- [Savings requests](https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ClientDepositRequest.php): `app/Livewire/ClientDepositRequest.php`
- [Account and withdrawal review](https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/AgentDepositReview.php): `app/Livewire/AgentDepositReview.php`
- [MVola adapter](https://github.com/iandolalaina/microfinnance/tree/main/app/Services/Mvola): `app/Services/Mvola`
- [MVola webhook](https://github.com/iandolalaina/microfinnance/blob/main/app/Http/Controllers/Api/MvolaWebhookController.php): `app/Http/Controllers/Api/MvolaWebhookController.php`
- [Payment confirmation](https://github.com/iandolalaina/microfinnance/blob/main/app/Services/PaymentConfirmationService.php): `app/Services/PaymentConfirmationService.php`
- [Receipt download](https://github.com/iandolalaina/microfinnance/blob/main/app/Http/Controllers/ReceiptController.php): `app/Http/Controllers/ReceiptController.php`

### Loan servicing

- [Loan request](https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ClientLoanRequest.php): `app/Livewire/ClientLoanRequest.php`
- [Loan review](https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/LoanRequestReview.php): `app/Livewire/LoanRequestReview.php`
- [Loan calculations](https://github.com/iandolalaina/microfinnance/blob/main/app/Services/LoanService.php): `app/Services/LoanService.php`
- [Loan payments](https://github.com/iandolalaina/microfinnance/blob/main/app/Livewire/ManualLoanPayment.php): `app/Livewire/ManualLoanPayment.php`

### Member communications

- [Announcements](https://github.com/iandolalaina/microfinnance/blob/main/app/Services/AnnouncementDeliveryService.php): `app/Services/AnnouncementDeliveryService.php`
- [Push subscriptions](https://github.com/iandolalaina/microfinnance/blob/main/app/Http/Controllers/PushSubscriptionController.php): `app/Http/Controllers/PushSubscriptionController.php`
- [Payment SMS listener](https://github.com/iandolalaina/microfinnance/blob/main/app/Listeners/SendPaymentReceivedSms.php): `app/Listeners/SendPaymentReceivedSms.php`

### Finance records

- [Payments and schedules](https://github.com/iandolalaina/microfinnance/blob/main/app/Models/Payment.php): `app/Models/Payment.php`
- [Savings accounts](https://github.com/iandolalaina/microfinnance/blob/main/app/Models/SavingsAccount.php): `app/Models/SavingsAccount.php`
- [Loans and schedules](https://github.com/iandolalaina/microfinnance/blob/main/app/Models/Loan.php): `app/Models/Loan.php`
- [Users and groups](https://github.com/iandolalaina/microfinnance/blob/main/app/Models/User.php): `app/Models/User.php`
- [Payment received event](https://github.com/iandolalaina/microfinnance/blob/main/app/Events/PaymentReceived.php): `app/Events/PaymentReceived.php`

### Other components

- **Member**
- **Agent**
- **MVola**
- **Push service**

## Connections

- Member → Login and registration: signs in (evidence: `app/Http/Controllers/Auth/LoginController.php`)
- Agent → Login and registration: signs in (evidence: `app/Http/Controllers/Auth/LoginController.php`)
- Member → Client dashboard: views activity
- Member → Savings requests: requests savings (evidence: `README.md`)
- Savings requests → Savings accounts: creates and reads (evidence: `app/Livewire/ClientDepositRequest.php`)
- Savings requests → Payments and schedules: creates payments (evidence: `app/Livewire/ClientDepositRequest.php`)
- Savings requests → MVola adapter: starts deposit (evidence: `app/Livewire/ClientDepositRequest.php`)
- MVola adapter → MVola: initiates payment (evidence: `README.md`)
- MVola → MVola webhook: sends callback (evidence: `README.md`)
- MVola webhook → Payments and schedules: looks up payment (evidence: `app/Http/Controllers/Api/MvolaWebhookController.php`)
- MVola webhook → Payment confirmation: confirms payment (evidence: `app/Http/Controllers/Api/MvolaWebhookController.php`)
- Payment confirmation → Payments and schedules: updates payment (evidence: `app/Services/PaymentConfirmationService.php`)
- Payment confirmation → Loans and schedules: applies loan payment (evidence: `app/Services/PaymentConfirmationService.php`)
- Payment confirmation → Payment received event: dispatches event (evidence: `app/Services/PaymentConfirmationService.php`)
- Payment confirmation → Receipt download: stores receipt
- Member → Receipt download: downloads receipt (evidence: `README.md`)
- Agent → Account and withdrawal review: reviews requests (evidence: `README.md`)
- Account and withdrawal review → Savings accounts: approves accounts
- Account and withdrawal review → Payments and schedules: records withdrawals
- Member → Loan request: requests loan
- Loan request → Loans and schedules: reads loan options (evidence: `app/Livewire/ClientLoanRequest.php`)
- Loan request → Loan calculations: submits loan (evidence: `app/Livewire/ClientLoanRequest.php`)
- Loan calculations → Loans and schedules: creates schedules (evidence: `app/Services/LoanService.php`)
- Agent → Loan review: reviews loan
- Loan review → Loan calculations: processes review
- Member → Loan payments: makes repayment
- Loan payments → Payments and schedules: records payment
- Payment received event → Payment SMS listener: triggers listener (evidence: `app/Providers/AppServiceProvider.php`)
- Agent → Announcements: publishes notice (evidence: `README.md`)
- Announcements → Member: delivers notice (evidence: `README.md`)
- Member → Push subscriptions: enables notifications (evidence: `README.md`)
- Push subscriptions → Push service: registers endpoint
- Announcements → Push service: sends push (evidence: `README.md`)
- Push subscriptions → Users and groups: stores subscription (evidence: `app/Http/Controllers/PushSubscriptionController.php`)
