# kavee234/fund-management-project architecture

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

- Interactive diagram: https://gitdiagram.com/kavee234/fund-management-project
- Repository: https://github.com/kavee234/fund-management-project

## Overview

This is a browser-based shared fund ledger, delivered as a small installable web app. Users select a fund and authenticate, then view monthly member records and record contributions, receipts, and shared expenses; the app synchronizes shared state and refreshes approved views. The principal logic is concentrated in script.js, so its domain responsibilities are shown as separate components sharing that path. The excerpts show validation, refresh, and service-worker behavior, but do not expose the complete UI wiring or database operations; those links are omitted or marked unverified.

Main entry points: [`script.js`](https://github.com/kavee234/fund-management-project/blob/main/script.js) (Shared ledger sync), [`service-worker.js`](https://github.com/kavee234/fund-management-project/blob/main/service-worker.js) (Offline cache worker), [`index.html`](https://github.com/kavee234/fund-management-project/blob/main/index.html) (Browser interface), [`supabase-config.js`](https://github.com/kavee234/fund-management-project/blob/main/supabase-config.js) (Supabase configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Fund access"]
  node_access_flow["Fund selection and PIN<br/>[script.js]"]
end

subgraph group_ledger["Fund ledger"]
  node_shared_sync["Shared ledger sync<br/>[script.js]"]
  node_contributions["Contributions<br/>[script.js]"]
  node_receipts["Collection receipts<br/>[script.js]"]
  node_expenses["Shared expenses<br/>[script.js]"]
  node_member_views["Member and transaction views<br/>[script.js]"]
end

subgraph group_app["Web app shell"]
  node_ui["Browser interface<br/>[index.html]"]
  node_worker["Offline cache worker<br/>[service-worker.js]"]
end

subgraph group_data["Shared data"]
  node_config["Supabase configuration<br/>[supabase-config.js]"]
  node_schema["Fund database setup<br/>[supabase-setup.sql]"]
  node_privacy_migration["Privacy migration"]
end

node_user(("Fund user"))
node_supabase[("Supabase service")]

node_user -->|"selects fund"| node_access_flow
node_access_flow -.->|"grants view"| node_shared_sync
node_shared_sync -.->|"activates state"| node_contributions
node_shared_sync -.->|"activates state"| node_receipts
node_shared_sync -.->|"activates state"| node_expenses
node_shared_sync -.->|"refreshes view"| node_member_views
node_ui -.->|"hosts app logic"| node_shared_sync
node_shared_sync -.->|"syncs records"| node_supabase
node_config -.->|"configures endpoint"| node_supabase
node_schema -.->|"sets up storage"| node_supabase
node_privacy_migration -.->|"updates privacy"| node_supabase
node_shared_sync -->|"registers worker"| node_worker
node_worker -->|"caches shell"| node_ui
node_worker -->|"caches config"| node_config

click node_access_flow "https://github.com/kavee234/fund-management-project/blob/main/script.js"
click node_shared_sync "https://github.com/kavee234/fund-management-project/blob/main/script.js"
click node_contributions "https://github.com/kavee234/fund-management-project/blob/main/script.js"
click node_receipts "https://github.com/kavee234/fund-management-project/blob/main/script.js"
click node_expenses "https://github.com/kavee234/fund-management-project/blob/main/script.js"
click node_member_views "https://github.com/kavee234/fund-management-project/blob/main/script.js"
click node_ui "https://github.com/kavee234/fund-management-project/blob/main/index.html"
click node_worker "https://github.com/kavee234/fund-management-project/blob/main/service-worker.js"
click node_config "https://github.com/kavee234/fund-management-project/blob/main/supabase-config.js"
click node_schema "https://github.com/kavee234/fund-management-project/blob/main/supabase-setup.sql"
click node_privacy_migration "https://github.com/kavee234/fund-management-project/blob/main/supabase-privacy-migration.sql"

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_access_flow,node_user toneBlue
class node_shared_sync,node_contributions,node_receipts,node_expenses,node_member_views,node_supabase toneAmber
class node_ui,node_worker toneMint
class node_config,node_schema,node_privacy_migration toneRose
```

## Components

### Fund access

- [Fund selection and PIN](https://github.com/kavee234/fund-management-project/blob/main/script.js): `script.js`

### Fund ledger

- [Shared ledger sync](https://github.com/kavee234/fund-management-project/blob/main/script.js): `script.js`
- [Contributions](https://github.com/kavee234/fund-management-project/blob/main/script.js): `script.js`
- [Collection receipts](https://github.com/kavee234/fund-management-project/blob/main/script.js): `script.js`
- [Shared expenses](https://github.com/kavee234/fund-management-project/blob/main/script.js): `script.js`
- [Member and transaction views](https://github.com/kavee234/fund-management-project/blob/main/script.js): `script.js`

### Web app shell

- [Browser interface](https://github.com/kavee234/fund-management-project/blob/main/index.html): `index.html`
- [Offline cache worker](https://github.com/kavee234/fund-management-project/blob/main/service-worker.js): `service-worker.js`

### Shared data

- [Supabase configuration](https://github.com/kavee234/fund-management-project/blob/main/supabase-config.js): `supabase-config.js`
- [Fund database setup](https://github.com/kavee234/fund-management-project/blob/main/supabase-setup.sql): `supabase-setup.sql`
- [Privacy migration](https://github.com/kavee234/fund-management-project/blob/main/supabase-privacy-migration.sql): `supabase-privacy-migration.sql`

### Other components

- **Fund user**
- **Supabase service**

## Connections

- Fund user → Fund selection and PIN: selects fund (evidence: `script.js`)
- Fund selection and PIN → Shared ledger sync: grants view (evidence: `script.js`)
- Shared ledger sync → Contributions: activates state (evidence: `script.js`)
- Shared ledger sync → Collection receipts: activates state (evidence: `script.js`)
- Shared ledger sync → Shared expenses: activates state (evidence: `script.js`)
- Shared ledger sync → Member and transaction views: refreshes view (evidence: `script.js`)
- Browser interface → Shared ledger sync: hosts app logic
- Shared ledger sync → Supabase service: syncs records
- Supabase configuration → Supabase service: configures endpoint
- Fund database setup → Supabase service: sets up storage
- Privacy migration → Supabase service: updates privacy
- Shared ledger sync → Offline cache worker: registers worker (evidence: `script.js`)
- Offline cache worker → Browser interface: caches shell (evidence: `service-worker.js`)
- Offline cache worker → Supabase configuration: caches config (evidence: `service-worker.js`)
