# jleongxd/airost2627_moneylai architecture

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

- Interactive diagram: https://gitdiagram.com/jleongxd/airost2627_moneylai
- Repository: https://github.com/jleongxd/airost2627_moneylai

## Overview

MoneyLai is a role-controlled club expense and reimbursement application. Members create and submit claims, Treasurers review them and record payments made externally, and Presidents oversee budgets and financial summaries. The map also preserves receipt assistance and checking, clarifications, activity proposals, exports, and refresh behavior. The README supports the main role workflows and product capabilities; source excerpts show editor, AI-check, reporting, and refresh details. Other route-level links are omitted where the sampled source does not establish the call path.

Main entry points: [`web/src/features/claims/ClaimEditorPage.tsx`](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/claims/ClaimEditorPage.tsx) (Draft and submit), [`web/src/features/claims/ClaimDetailPage.tsx`](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/claims/ClaimDetailPage.tsx) (Claim review), [`web/src/lib/api.ts`](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/api.ts) (Claim operations), [`web/src/features/auth/LoginPage.tsx`](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/auth/LoginPage.tsx) (Sign in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and shell"]
  node_login["Sign in<br/>[LoginPage.tsx]"]
  node_auth["Auth state<br/>[AuthProvider.tsx]"]
  node_supabase_auth[("Supabase Auth")]
  node_refresh["Live refresh<br/>[useLoad.ts]"]
  node_live_query["Refresh coordination<br/>[live-query.ts]"]
  node_live_sync["Polling and sync status<br/>[live-sync.ts]"]
end

subgraph group_claims["Claims workflow"]
  node_claim_editor["Draft and submit"]
  node_claim_review["Claim review"]
  node_my_claims["Claim tracking<br/>[MyClaimsPage.tsx]"]
  node_claim_api["Claim operations<br/>[api.ts]"]
  node_finance_store[("Claims and finance data")]
end

subgraph group_finance["Club finance"]
  node_activities["Activities<br/>[ActivitiesPage.tsx]"]
  node_profile["Payout profile<br/>[ProfilePage.tsx]"]
  node_treasury["Treasury payments<br/>[TreasuryPage.tsx]"]
end

subgraph group_assistance["Receipt assistance"]
  node_receipt_assistant["Receipt drafting"]
  node_allocation["Item allocation"]
  node_receipt_extract["Receipt extraction<br/>[route.ts]"]
  node_ai_check["Claim AI check<br/>[route.ts]"]
  node_gemini{{"Gemini"}}
end

subgraph group_oversight["Oversight and reporting"]
  node_president_view["Budget oversight<br/>[PresidentPage.tsx]"]
  node_budget_requests["Budget proposals<br/>[BudgetRequests.tsx]"]
  node_activity_export["Activity evidence packs<br/>[activity-pack.ts]"]
  node_export_route["Export endpoint<br/>[route.ts]"]
end

node_member(("Member"))
node_treasurer(("Treasurer"))
node_president(("President"))

node_member -->|"signs in"| node_login
node_login -->|"authenticates"| node_supabase_auth
node_login -->|"reads session"| node_auth
node_member -->|"creates claim"| node_claim_editor
node_claim_editor -->|"loads and saves"| node_claim_api
node_claim_api -.->|"reads and writes"| node_finance_store
node_claim_editor -->|"offers drafting"| node_receipt_assistant
node_receipt_assistant -->|"requests extraction"| node_receipt_extract
node_receipt_extract -->|"extracts receipt"| node_gemini
node_receipt_assistant -->|"validates allocation"| node_allocation
node_member -->|"tracks status"| node_my_claims
node_member -->|"answers requests"| node_claim_review
node_treasurer -->|"reviews claims"| node_claim_review
node_claim_review -.->|"performs operations"| node_claim_api
node_claim_review -->|"runs optional check"| node_ai_check
node_ai_check -->|"checks receipts"| node_gemini
node_ai_check -->|"calculates plan"| node_allocation
node_treasurer -->|"records payment"| node_treasury
node_treasury -.->|"records external payment"| node_finance_store
node_member -->|"maintains payout details"| node_profile
node_treasurer -->|"proposes activities"| node_activities
node_president -->|"reviews proposals"| node_budget_requests
node_president -->|"reviews finances"| node_president_view
node_president_view -->|"loads overview"| node_claim_api
node_treasurer -->|"exports evidence"| node_export_route
node_president -->|"exports summary"| node_export_route
node_export_route -.->|"generates pack"| node_activity_export
node_claim_editor -.->|"uses refresh hook"| node_refresh
node_refresh -->|"creates query"| node_live_query
node_refresh -->|"subscribes refresh"| node_live_sync

click node_login "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/auth/LoginPage.tsx"
click node_auth "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/components/AuthProvider.tsx"
click node_claim_editor "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/claims/ClaimEditorPage.tsx"
click node_claim_review "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/claims/ClaimDetailPage.tsx"
click node_my_claims "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/claims/MyClaimsPage.tsx"
click node_claim_api "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/api.ts"
click node_activities "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/activities/ActivitiesPage.tsx"
click node_profile "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/profile/ProfilePage.tsx"
click node_treasury "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/treasury/TreasuryPage.tsx"
click node_receipt_assistant "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/components/ReceiptAssistant.tsx"
click node_allocation "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/ai/receipt-allocation.ts"
click node_receipt_extract "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/app/api/receipt-drafts/%5Bid%5D/extract/route.ts"
click node_ai_check "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/app/api/claims/%5Bid%5D/ai-check/route.ts"
click node_president_view "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/president/PresidentPage.tsx"
click node_budget_requests "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/components/BudgetRequests.tsx"
click node_activity_export "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/reports/activity-pack.ts"
click node_export_route "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/app/api/activities/%5Bid%5D/export/route.ts"
click node_refresh "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/useLoad.ts"
click node_live_query "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/live-query.ts"
click node_live_sync "https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/live-sync.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_login,node_auth,node_supabase_auth,node_refresh,node_live_query,node_live_sync toneBlue
class node_claim_editor,node_claim_review,node_my_claims,node_claim_api,node_finance_store toneAmber
class node_activities,node_profile,node_treasury toneMint
class node_receipt_assistant,node_allocation,node_receipt_extract,node_ai_check,node_gemini toneRose
class node_president_view,node_budget_requests,node_activity_export,node_export_route,node_member,node_treasurer,node_president toneIndigo
```

## Components

### Identity and shell

- [Sign in](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/auth/LoginPage.tsx): `web/src/features/auth/LoginPage.tsx`
- [Auth state](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/components/AuthProvider.tsx): `web/src/components/AuthProvider.tsx`
- **Supabase Auth**
- [Live refresh](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/useLoad.ts): `web/src/lib/useLoad.ts`
- [Refresh coordination](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/live-query.ts): `web/src/lib/live-query.ts`
- [Polling and sync status](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/live-sync.ts): `web/src/lib/live-sync.ts`

### Claims workflow

- [Draft and submit](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/claims/ClaimEditorPage.tsx): `web/src/features/claims/ClaimEditorPage.tsx`
- [Claim review](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/claims/ClaimDetailPage.tsx): `web/src/features/claims/ClaimDetailPage.tsx`
- [Claim tracking](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/claims/MyClaimsPage.tsx): `web/src/features/claims/MyClaimsPage.tsx`
- [Claim operations](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/api.ts): `web/src/lib/api.ts`
- **Claims and finance data**

### Club finance

- [Activities](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/activities/ActivitiesPage.tsx): `web/src/features/activities/ActivitiesPage.tsx`
- [Payout profile](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/profile/ProfilePage.tsx): `web/src/features/profile/ProfilePage.tsx`
- [Treasury payments](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/treasury/TreasuryPage.tsx): `web/src/features/treasury/TreasuryPage.tsx`

### Receipt assistance

- [Receipt drafting](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/components/ReceiptAssistant.tsx): `web/src/components/ReceiptAssistant.tsx`
- [Item allocation](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/ai/receipt-allocation.ts): `web/src/lib/ai/receipt-allocation.ts`
- [Receipt extraction](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/app/api/receipt-drafts/%5Bid%5D/extract/route.ts): `web/src/app/api/receipt-drafts/[id]/extract/route.ts`
- [Claim AI check](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/app/api/claims/%5Bid%5D/ai-check/route.ts): `web/src/app/api/claims/[id]/ai-check/route.ts`
- **Gemini**

### Oversight and reporting

- [Budget oversight](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/features/president/PresidentPage.tsx): `web/src/features/president/PresidentPage.tsx`
- [Budget proposals](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/components/BudgetRequests.tsx): `web/src/components/BudgetRequests.tsx`
- [Activity evidence packs](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/lib/reports/activity-pack.ts): `web/src/lib/reports/activity-pack.ts`
- [Export endpoint](https://github.com/jleongxd/airost2627_moneylai/blob/main/web/src/app/api/activities/%5Bid%5D/export/route.ts): `web/src/app/api/activities/[id]/export/route.ts`

### Other components

- **Member**
- **Treasurer**
- **President**

## Connections

- Member → Sign in: signs in (evidence: `README.md`)
- Sign in → Supabase Auth: authenticates (evidence: `web/src/features/auth/LoginPage.tsx`)
- Sign in → Auth state: reads session (evidence: `web/src/features/auth/LoginPage.tsx`)
- Member → Draft and submit: creates claim (evidence: `README.md`)
- Draft and submit → Claim operations: loads and saves (evidence: `web/src/features/claims/ClaimEditorPage.tsx`)
- Claim operations → Claims and finance data: reads and writes
- Draft and submit → Receipt drafting: offers drafting (evidence: `web/src/features/claims/ClaimEditorPage.tsx`)
- Receipt drafting → Receipt extraction: requests extraction (evidence: `README.md`)
- Receipt extraction → Gemini: extracts receipt (evidence: `README.md`)
- Receipt drafting → Item allocation: validates allocation
- Member → Claim tracking: tracks status (evidence: `README.md`)
- Member → Claim review: answers requests (evidence: `README.md`)
- Treasurer → Claim review: reviews claims (evidence: `README.md`)
- Claim review → Claim operations: performs operations
- Claim review → Claim AI check: runs optional check (evidence: `README.md`)
- Claim AI check → Gemini: checks receipts (evidence: `README.md`)
- Claim AI check → Item allocation: calculates plan (evidence: `web/src/app/api/claims/[id]/ai-check/route.ts`)
- Treasurer → Treasury payments: records payment (evidence: `README.md`)
- Treasury payments → Claims and finance data: records external payment
- Member → Payout profile: maintains payout details (evidence: `README.md`)
- Treasurer → Activities: proposes activities (evidence: `README.md`)
- President → Budget proposals: reviews proposals (evidence: `README.md`)
- President → Budget oversight: reviews finances (evidence: `README.md`)
- Budget oversight → Claim operations: loads overview (evidence: `web/src/features/president/PresidentPage.tsx`)
- Treasurer → Export endpoint: exports evidence (evidence: `README.md`)
- President → Export endpoint: exports summary (evidence: `README.md`)
- Export endpoint → Activity evidence packs: generates pack
- Draft and submit → Live refresh: uses refresh hook
- Live refresh → Refresh coordination: creates query (evidence: `web/src/lib/useLoad.ts`)
- Live refresh → Polling and sync status: subscribes refresh (evidence: `web/src/lib/useLoad.ts`)
