# vinayv15/finance-hub architecture

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

- Interactive diagram: https://gitdiagram.com/vinayv15/finance-hub
- Repository: https://github.com/vinayv15/finance-hub

## Overview

Finance Hub is a private personal-finance dashboard. The owner connects financial accounts or imports/enters data; the app syncs and classifies transactions, stores account and loan data, and serves analytics, planning, and mortgage views to the web UI. The README documents both a local Flask/SQLite version and a cloud Supabase/Postgres version. Unsampled modules and routes are represented only where the README or SOURCE INDEX supports their role; the graph does not assume unshown call chains.

Main entry points: [`supabase/functions/api/index.ts`](https://github.com/vinayv15/finance-hub/blob/main/supabase/functions/api/index.ts) (Edge API), [`classify.py`](https://github.com/vinayv15/finance-hub/blob/main/classify.py) (Transaction classification), [`app.py`](https://github.com/vinayv15/finance-hub/blob/main/app.py) (Flask API), [`web/src/App.tsx`](https://github.com/vinayv15/finance-hub/blob/main/web/src/App.tsx) (App and routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web dashboard"]
  node_app_ui["App and routes<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_planning_ui["Goals and projection<br/>[Projection.tsx]"]
  node_mortgage_ui["Mortgage view<br/>[Mortgage.tsx]"]
  node_other_pages["Finance pages"]
  node_charts["Charts and visualizations<br/>[Charts.tsx]"]
  node_web_state["Fetch and range state<br/>[hooks.tsx]"]
end

subgraph group_local["Local service"]
  node_local_api["Flask API<br/>[app.py]"]
end

subgraph group_cloud["Cloud service"]
  node_cloud_api["Edge API<br/>[index.ts]"]
end

subgraph group_finance["Finance domain"]
  node_plaid["Plaid sync<br/>[plaid_sync.py]"]
  node_cloud_plaid["Cloud Plaid<br/>[plaid.ts]"]
  node_statements["Statement import<br/>[statements.py]"]
  node_manual["Manual balances<br/>[manual.py]"]
  node_classification["Transaction classification<br/>[classify.py]"]
  node_analytics["Analytics<br/>[analytics.py]"]
  node_insights["Insights<br/>[insights.py]"]
  node_planning["Planning<br/>[planning.py]"]
  node_mortgage["Mortgage model<br/>[mortgage.py]"]
  node_home["Home value<br/>[home.py]"]
end

subgraph group_storage["Persistence"]
  node_sqlite[("SQLite database<br/>[db.py]")]
  node_cloud_db[("Postgres access<br/>[db.ts]")]
end

node_owner(("Owner"))
node_plaid_service["Plaid"]
node_supabase_auth["Supabase sign-in"]

node_owner -->|"uses"| node_app_ui
node_app_ui -->|"routes to"| node_dashboard
node_app_ui -->|"routes to"| node_planning_ui
node_app_ui -->|"routes to"| node_mortgage_ui
node_app_ui -->|"routes to"| node_other_pages
node_dashboard -->|"fetches from"| node_api_client
node_planning_ui -->|"fetches from"| node_api_client
node_mortgage_ui -->|"fetches from"| node_api_client
node_dashboard -->|"renders"| node_charts
node_dashboard -->|"uses"| node_web_state
node_api_client -.->|"requests"| node_cloud_api
node_api_client -.->|"requests"| node_local_api
node_supabase_auth -.->|"signs in"| node_app_ui
node_local_api -->|"reads and writes"| node_sqlite
node_cloud_api -->|"uses"| node_cloud_db
node_local_api -->|"dispatches sync"| node_plaid
node_plaid -.->|"syncs accounts"| node_plaid_service
node_cloud_api -->|"dispatches"| node_cloud_plaid
node_cloud_plaid -.->|"syncs accounts"| node_plaid_service
node_local_api -->|"dispatches edits"| node_manual
node_local_api -->|"runs classification"| node_classification
node_plaid -->|"classifies transactions"| node_classification
node_statements -->|"classifies imports"| node_classification
node_classification -->|"stores classifications"| node_sqlite
node_local_api -->|"queries analytics"| node_analytics
node_insights -->|"uses analytics"| node_analytics
node_insights -->|"uses planning"| node_planning
node_insights -->|"uses mortgage model"| node_mortgage
node_planning -->|"uses analytics"| node_analytics
node_planning -->|"uses mortgage model"| node_mortgage
node_mortgage -->|"uses home data"| node_home
node_mortgage -->|"reads and writes"| node_sqlite
node_analytics -->|"queries"| node_sqlite
node_home -->|"reads and writes"| node_sqlite
node_cloud_api -->|"dispatches"| node_classification
node_cloud_api -->|"dispatches"| node_insights
node_cloud_api -->|"dispatches"| node_planning
node_cloud_api -->|"dispatches"| node_mortgage
node_cloud_plaid -->|"uses"| node_classification
node_classification -->|"reads and writes"| node_cloud_db
node_analytics -->|"uses model"| node_mortgage
node_manual -.->|"stores balances"| node_sqlite
node_cloud_api -->|"dispatches"| node_manual
node_insights -->|"uses home data"| node_home

click node_app_ui "https://github.com/vinayv15/finance-hub/blob/main/web/src/App.tsx"
click node_api_client "https://github.com/vinayv15/finance-hub/blob/main/web/src/api.ts"
click node_dashboard "https://github.com/vinayv15/finance-hub/blob/main/web/src/pages/Dashboard.tsx"
click node_planning_ui "https://github.com/vinayv15/finance-hub/blob/main/web/src/pages/Projection.tsx"
click node_mortgage_ui "https://github.com/vinayv15/finance-hub/blob/main/web/src/pages/Mortgage.tsx"
click node_other_pages "https://github.com/vinayv15/finance-hub/tree/main/web/src/pages"
click node_charts "https://github.com/vinayv15/finance-hub/blob/main/web/src/components/Charts.tsx"
click node_web_state "https://github.com/vinayv15/finance-hub/blob/main/web/src/hooks.tsx"
click node_local_api "https://github.com/vinayv15/finance-hub/blob/main/app.py"
click node_cloud_api "https://github.com/vinayv15/finance-hub/blob/main/supabase/functions/api/index.ts"
click node_plaid "https://github.com/vinayv15/finance-hub/blob/main/plaid_sync.py"
click node_cloud_plaid "https://github.com/vinayv15/finance-hub/blob/main/supabase/functions/api/lib/plaid.ts"
click node_statements "https://github.com/vinayv15/finance-hub/blob/main/statements.py"
click node_manual "https://github.com/vinayv15/finance-hub/blob/main/manual.py"
click node_classification "https://github.com/vinayv15/finance-hub/blob/main/classify.py"
click node_analytics "https://github.com/vinayv15/finance-hub/blob/main/analytics.py"
click node_insights "https://github.com/vinayv15/finance-hub/blob/main/insights.py"
click node_planning "https://github.com/vinayv15/finance-hub/blob/main/planning.py"
click node_mortgage "https://github.com/vinayv15/finance-hub/blob/main/mortgage.py"
click node_home "https://github.com/vinayv15/finance-hub/blob/main/home.py"
click node_sqlite "https://github.com/vinayv15/finance-hub/blob/main/db.py"
click node_cloud_db "https://github.com/vinayv15/finance-hub/blob/main/supabase/functions/api/lib/db.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_ui,node_api_client,node_dashboard,node_planning_ui,node_mortgage_ui,node_other_pages,node_charts,node_web_state toneBlue
class node_local_api toneAmber
class node_cloud_api toneMint
class node_plaid,node_cloud_plaid,node_statements,node_manual,node_classification,node_analytics,node_insights,node_planning,node_mortgage,node_home toneRose
class node_sqlite,node_cloud_db,node_owner,node_plaid_service,node_supabase_auth toneIndigo
```

## Components

### Web dashboard

- [App and routes](https://github.com/vinayv15/finance-hub/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [API client](https://github.com/vinayv15/finance-hub/blob/main/web/src/api.ts): `web/src/api.ts`
- [Dashboard](https://github.com/vinayv15/finance-hub/blob/main/web/src/pages/Dashboard.tsx): `web/src/pages/Dashboard.tsx`
- [Goals and projection](https://github.com/vinayv15/finance-hub/blob/main/web/src/pages/Projection.tsx): `web/src/pages/Projection.tsx`
- [Mortgage view](https://github.com/vinayv15/finance-hub/blob/main/web/src/pages/Mortgage.tsx): `web/src/pages/Mortgage.tsx`
- [Finance pages](https://github.com/vinayv15/finance-hub/tree/main/web/src/pages): `web/src/pages`
- [Charts and visualizations](https://github.com/vinayv15/finance-hub/blob/main/web/src/components/Charts.tsx): `web/src/components/Charts.tsx`
- [Fetch and range state](https://github.com/vinayv15/finance-hub/blob/main/web/src/hooks.tsx): `web/src/hooks.tsx`

### Local service

- [Flask API](https://github.com/vinayv15/finance-hub/blob/main/app.py): `app.py`

### Cloud service

- [Edge API](https://github.com/vinayv15/finance-hub/blob/main/supabase/functions/api/index.ts): `supabase/functions/api/index.ts`

### Finance domain

- [Plaid sync](https://github.com/vinayv15/finance-hub/blob/main/plaid_sync.py): `plaid_sync.py`
- [Cloud Plaid](https://github.com/vinayv15/finance-hub/blob/main/supabase/functions/api/lib/plaid.ts): `supabase/functions/api/lib/plaid.ts`
- [Statement import](https://github.com/vinayv15/finance-hub/blob/main/statements.py): `statements.py`
- [Manual balances](https://github.com/vinayv15/finance-hub/blob/main/manual.py): `manual.py`
- [Transaction classification](https://github.com/vinayv15/finance-hub/blob/main/classify.py): `classify.py`
- [Analytics](https://github.com/vinayv15/finance-hub/blob/main/analytics.py): `analytics.py`
- [Insights](https://github.com/vinayv15/finance-hub/blob/main/insights.py): `insights.py`
- [Planning](https://github.com/vinayv15/finance-hub/blob/main/planning.py): `planning.py`
- [Mortgage model](https://github.com/vinayv15/finance-hub/blob/main/mortgage.py): `mortgage.py`
- [Home value](https://github.com/vinayv15/finance-hub/blob/main/home.py): `home.py`

### Persistence

- [SQLite database](https://github.com/vinayv15/finance-hub/blob/main/db.py): `db.py`
- [Postgres access](https://github.com/vinayv15/finance-hub/blob/main/supabase/functions/api/lib/db.ts): `supabase/functions/api/lib/db.ts`

### Other components

- **Owner**
- **Plaid**
- **Supabase sign-in**

## Connections

- Owner → App and routes: uses (evidence: `README.md`)
- App and routes → Dashboard: routes to (evidence: `web/src/App.tsx`)
- App and routes → Goals and projection: routes to (evidence: `web/src/App.tsx`)
- App and routes → Mortgage view: routes to (evidence: `web/src/App.tsx`)
- App and routes → Finance pages: routes to (evidence: `web/src/App.tsx`)
- Dashboard → API client: fetches from (evidence: `web/src/pages/Dashboard.tsx`)
- Goals and projection → API client: fetches from (evidence: `web/src/pages/Projection.tsx`)
- Mortgage view → API client: fetches from (evidence: `web/src/pages/Mortgage.tsx`)
- Dashboard → Charts and visualizations: renders (evidence: `web/src/pages/Dashboard.tsx`)
- Dashboard → Fetch and range state: uses (evidence: `web/src/pages/Dashboard.tsx`)
- API client → Edge API: requests (evidence: `README.md`)
- API client → Flask API: requests (evidence: `README.md`)
- Supabase sign-in → App and routes: signs in (evidence: `README.md`)
- Flask API → SQLite database: reads and writes (evidence: `app.py`)
- Edge API → Postgres access: uses (evidence: `supabase/functions/api/index.ts`)
- Flask API → Plaid sync: dispatches sync (evidence: `app.py`)
- Plaid sync → Plaid: syncs accounts (evidence: `README.md`)
- Edge API → Cloud Plaid: dispatches (evidence: `supabase/functions/api/index.ts`)
- Cloud Plaid → Plaid: syncs accounts (evidence: `README.md`)
- Flask API → Manual balances: dispatches edits (evidence: `app.py`)
- Flask API → Transaction classification: runs classification (evidence: `app.py`)
- Plaid sync → Transaction classification: classifies transactions (evidence: `plaid_sync.py`)
- Statement import → Transaction classification: classifies imports (evidence: `statements.py`)
- Transaction classification → SQLite database: stores classifications (evidence: `classify.py`)
- Flask API → Analytics: queries analytics (evidence: `app.py`)
- Insights → Analytics: uses analytics (evidence: `insights.py`)
- Insights → Planning: uses planning (evidence: `insights.py`)
- Insights → Mortgage model: uses mortgage model (evidence: `insights.py`)
- Planning → Analytics: uses analytics (evidence: `planning.py`)
- Planning → Mortgage model: uses mortgage model (evidence: `planning.py`)
- Mortgage model → Home value: uses home data (evidence: `mortgage.py`)
- Mortgage model → SQLite database: reads and writes (evidence: `mortgage.py`)
- Analytics → SQLite database: queries (evidence: `analytics.py`)
- Home value → SQLite database: reads and writes (evidence: `home.py`)
- Edge API → Transaction classification: dispatches (evidence: `supabase/functions/api/index.ts`)
- Edge API → Insights: dispatches (evidence: `supabase/functions/api/index.ts`)
- Edge API → Planning: dispatches (evidence: `supabase/functions/api/index.ts`)
- Edge API → Mortgage model: dispatches (evidence: `supabase/functions/api/index.ts`)
- Cloud Plaid → Transaction classification: uses (evidence: `supabase/functions/api/lib/plaid.ts`)
- Transaction classification → Postgres access: reads and writes
- Analytics → Mortgage model: uses model (evidence: `analytics.py`)
- Manual balances → SQLite database: stores balances
- Edge API → Manual balances: dispatches (evidence: `supabase/functions/api/index.ts`)
- Insights → Home value: uses home data (evidence: `insights.py`)
