# chito2k3/armmc-coop-loan-system architecture

> Architecture diagram of the GitHub repository chito2k3/armmc-coop-loan-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chito2k3/armmc-coop-loan-system
- Repository: https://github.com/chito2k3/armmc-coop-loan-system

## Overview

ARMMC Coop Loan System is a role-based cooperative loan-management app. Members and staff authenticate, submit and review loan applications, release funds, and track collections through full payment; admins also manage loan settings and monitor dashboards and risk. The README documents the lifecycle and risk capabilities, while sampled source confirms the dashboard’s loan queries, loan-detail routing, Firebase auth/profile setup, and settings operations. Several domain components are listed but unsampled, so their internal wiring is not asserted.

Main entry points: [`src/components/dashboard-client.tsx`](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/dashboard-client.tsx) (Loan dashboard), [`src/components/loan-form-sheet.tsx`](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/loan-form-sheet.tsx) (Loan application), [`src/firebase/provider.tsx`](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/provider.tsx) (Firebase auth), [`src/app/page.tsx`](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/app/page.tsx) (App entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and navigation"]
  node_app["App entry<br/>[page.tsx]"]
  node_auth["Sign-in and guards<br/>[auth-guard.tsx]"]
  node_roles["Role management"]
  node_dashboard["Loan dashboard"]
end

subgraph group_lifecycle["Loan lifecycle"]
  node_form["Loan application"]
  node_computation["Loan computation"]
  node_review["Approval review<br/>[approval-panel.tsx]"]
  node_detail["Loan details"]
  node_release["Fund release<br/>[release-panel.tsx]"]
  node_collection["Payment schedule"]
  node_penalty["Penalty service<br/>[penalty-service.ts]"]
end

subgraph group_oversight["Monitoring and risk"]
  node_risk["Borrower risk checks"]
  node_pastdue["Past-due monitoring<br/>[past-due-panel.tsx]"]
  node_analytics["Analytics reports"]
  node_settings["Loan settings"]
end

subgraph group_services["Firebase services"]
  node_firebase["Firebase setup<br/>[index.ts]"]
  node_identity["Firebase auth<br/>[provider.tsx]"]
  node_profiles["User profiles<br/>[user-service.ts]"]
  node_firestore[("Firestore")]
end

node_staff(("Coop users"))

node_staff -->|"uses"| node_app
node_app -->|"opens"| node_dashboard
node_staff -->|"signs in"| node_auth
node_auth -->|"checks session"| node_identity
node_identity -->|"ensures profile"| node_profiles
node_dashboard -->|"queries loans"| node_firestore
node_dashboard -->|"opens selected"| node_detail
node_staff -->|"applies"| node_form
node_form -.->|"computes terms"| node_computation
node_form -->|"submits for approval"| node_review
node_review -->|"approves for release"| node_release
node_release -->|"starts repayment"| node_collection
node_collection -.->|"tracks penalties"| node_penalty
node_staff -->|"administers"| node_roles
node_roles -->|"updates roles"| node_profiles
node_staff -->|"checks history"| node_risk
node_staff -->|"monitors dues"| node_pastdue
node_staff -->|"views insights"| node_analytics
node_staff -->|"configures"| node_settings
node_settings -->|"reads and writes"| node_firestore
node_firebase -->|"provides services"| node_identity

click node_app "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/app/page.tsx"
click node_auth "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/auth-guard.tsx"
click node_roles "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/admin-dashboard.tsx"
click node_dashboard "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/dashboard-client.tsx"
click node_form "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/loan-form-sheet.tsx"
click node_computation "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/loan-computation-dialog.tsx"
click node_review "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/approval-panel.tsx"
click node_detail "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/loan-detail-view-new.tsx"
click node_release "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/release-panel.tsx"
click node_collection "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/collection-schedule.tsx"
click node_penalty "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/penalty-service.ts"
click node_risk "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/existing-loans-check.tsx"
click node_pastdue "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/past-due-panel.tsx"
click node_analytics "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/analytics-dashboard.tsx"
click node_settings "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/settings-service.ts"
click node_firebase "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/index.ts"
click node_identity "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/provider.tsx"
click node_profiles "https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/user-service.ts"

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_auth,node_roles,node_dashboard,node_staff toneBlue
class node_form,node_computation,node_review,node_detail,node_release,node_collection,node_penalty toneAmber
class node_risk,node_pastdue,node_analytics,node_settings toneMint
class node_firebase,node_identity,node_profiles,node_firestore toneRose
```

## Components

### Access and navigation

- [App entry](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Sign-in and guards](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/auth-guard.tsx): `src/components/auth-guard.tsx`
- [Role management](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/admin-dashboard.tsx): `src/components/admin-dashboard.tsx`
- [Loan dashboard](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/dashboard-client.tsx): `src/components/dashboard-client.tsx`

### Loan lifecycle

- [Loan application](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/loan-form-sheet.tsx): `src/components/loan-form-sheet.tsx`
- [Loan computation](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/loan-computation-dialog.tsx): `src/components/loan-computation-dialog.tsx`
- [Approval review](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/approval-panel.tsx): `src/components/approval-panel.tsx`
- [Loan details](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/loan-detail-view-new.tsx): `src/components/loan-detail-view-new.tsx`
- [Fund release](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/release-panel.tsx): `src/components/release-panel.tsx`
- [Payment schedule](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/collection-schedule.tsx): `src/components/collection-schedule.tsx`
- [Penalty service](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/penalty-service.ts): `src/firebase/penalty-service.ts`

### Monitoring and risk

- [Borrower risk checks](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/existing-loans-check.tsx): `src/components/existing-loans-check.tsx`
- [Past-due monitoring](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/past-due-panel.tsx): `src/components/past-due-panel.tsx`
- [Analytics reports](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/components/analytics-dashboard.tsx): `src/components/analytics-dashboard.tsx`
- [Loan settings](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/settings-service.ts): `src/firebase/settings-service.ts`

### Firebase services

- [Firebase setup](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/index.ts): `src/firebase/index.ts`
- [Firebase auth](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/provider.tsx): `src/firebase/provider.tsx`
- [User profiles](https://github.com/chito2k3/armmc-coop-loan-system/blob/main/src/firebase/user-service.ts): `src/firebase/user-service.ts`
- **Firestore**

### Other components

- **Coop users**

## Connections

- Coop users → App entry: uses (evidence: `README.md`)
- App entry → Loan dashboard: opens (evidence: `src/app/page.tsx`)
- Coop users → Sign-in and guards: signs in (evidence: `README.md`)
- Sign-in and guards → Firebase auth: checks session (evidence: `src/components/auth-guard.tsx`)
- Firebase auth → User profiles: ensures profile (evidence: `src/firebase/provider.tsx`)
- Loan dashboard → Firestore: queries loans (evidence: `src/components/dashboard-client.tsx`)
- Loan dashboard → Loan details: opens selected (evidence: `src/components/dashboard-client.tsx`)
- Coop users → Loan application: applies (evidence: `README.md`)
- Loan application → Loan computation: computes terms
- Loan application → Approval review: submits for approval (evidence: `README.md`)
- Approval review → Fund release: approves for release (evidence: `README.md`)
- Fund release → Payment schedule: starts repayment (evidence: `README.md`)
- Payment schedule → Penalty service: tracks penalties
- Coop users → Role management: administers (evidence: `README.md`)
- Role management → User profiles: updates roles (evidence: `src/components/admin-dashboard.tsx`)
- Coop users → Borrower risk checks: checks history (evidence: `README.md`)
- Coop users → Past-due monitoring: monitors dues (evidence: `README.md`)
- Coop users → Analytics reports: views insights (evidence: `README.md`)
- Coop users → Loan settings: configures
- Loan settings → Firestore: reads and writes (evidence: `src/firebase/settings-service.ts`)
- Firebase setup → Firebase auth: provides services (evidence: `src/firebase/index.ts`)
