# ferdinjoe/indian-wealth-portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/ferdinjoe/indian-wealth-portfolio
- Repository: https://github.com/ferdinjoe/indian-wealth-portfolio

## Overview

Wealth Ledger is a local, private portfolio and net-worth web app. The user loads the ledger in a browser, explores holdings and financial views, and can update the ledger or request live rates, prices, backups, and reports. The graph preserves the documented analytics, allocation, health, goals, retirement, tax, and profile capabilities. Backend routing and cross-module calls are shown where the excerpts or SOURCE INDEX support them; some unsampled route details are omitted.

Main entry points: [`public/js/app.js`](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/app.js) (App controller), [`server.js`](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server.js) (HTTP service), [`public/js/api.js`](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/api.js) (API client), [`public/js/charts.js`](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/charts.js) (Charts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_app["App controller<br/>[app.js]"]
  node_api["API client<br/>[api.js]"]
  node_ui["UI helpers<br/>[ui.js]"]
  node_format["Formatting<br/>[format.js]"]
  node_charts["Charts<br/>[charts.js]"]
  node_offline["Offline snapshot<br/>[offline.js]"]
end

subgraph group_portfolio["Portfolio analysis"]
  node_holdings["Holdings<br/>[holdings.js]"]
  node_dashboard["Dashboard<br/>[dashboard.js]"]
  node_analytics["Wealth analytics<br/>[analytics.js]"]
  node_allocation["Allocation<br/>[allocation.js]"]
  node_health["Portfolio health<br/>[health.js]"]
  node_goals["Goals<br/>[goals.js]"]
  node_planner["Retirement planner<br/>[planner.js]"]
  node_planning["Projection engine<br/>[planning.js]"]
  node_tax["India tax<br/>[tax.js]"]
  node_profile["Profile<br/>[profile.js]"]
  node_settings["Settings and backups<br/>[settings.js]"]
  node_reportview["Report controls<br/>[report.js]"]
end

subgraph group_server["Local service"]
  node_server["HTTP service<br/>[server.js]"]
  node_valuation["Valuation<br/>[valuation.js]"]
  node_analysis["Returns and allocation<br/>[analysis.js]"]
  node_income["Income and tax<br/>[income.js]"]
  node_serverhealth["Health scoring<br/>[health.js]"]
  node_report["Report assembly<br/>[report.js]"]
  node_pdf["PDF generation<br/>[pdf.js]"]
end

subgraph group_data["Persistence and feeds"]
  node_store[("Ledger store<br/>[store.js]")]
  node_backups["Backup manager<br/>[backups.js]"]
  node_fx["FX rates<br/>[fx.js]"]
  node_prices["Equity prices<br/>[prices.js]"]
  node_metals["Bullion rates<br/>[metals.js]"]
  node_bonds["Bond prices<br/>[bonds.js]"]
end

node_user(("Ledger user"))
node_browser(("Web browser"))
node_publicfeeds(("Public market sources"))

node_user -->|"uses"| node_browser
node_browser -->|"loads app"| node_app
node_app -->|"requests state"| node_api
node_app -->|"renders"| node_holdings
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_analytics
node_app -->|"renders"| node_allocation
node_app -->|"renders"| node_health
node_app -->|"renders"| node_goals
node_app -->|"renders"| node_planner
node_app -->|"renders"| node_tax
node_app -->|"renders"| node_profile
node_app -->|"renders"| node_settings
node_app -->|"renders"| node_reportview
node_app -->|"shows feedback"| node_ui
node_app -->|"formats totals"| node_format
node_app -->|"clears charts"| node_charts
node_app -->|"saves snapshot"| node_offline
node_api -->|"HTTP requests"| node_server
node_holdings -->|"edits positions"| node_api
node_holdings -->|"uses forms"| node_ui
node_holdings -->|"formats values"| node_format
node_dashboard -->|"uses projections"| node_planning
node_dashboard -->|"plots data"| node_charts
node_analytics -->|"projects assets"| node_planning
node_analytics -->|"plots data"| node_charts
node_allocation -->|"reads state"| node_api
node_allocation -->|"plots allocation"| node_charts
node_health -->|"plots scores"| node_charts
node_goals -->|"manages goals"| node_api
node_planner -->|"builds plan"| node_planning
node_planner -->|"saves assumptions"| node_api
node_planner -->|"plots projections"| node_charts
node_tax -->|"reads state"| node_api
node_profile -->|"updates profile"| node_api
node_settings -->|"manages data"| node_api
node_settings -->|"clears snapshot"| node_offline
node_reportview -->|"requests report"| node_api
node_server -->|"loads and saves"| node_store
node_server -->|"manages copies"| node_backups
node_server -->|"computes values"| node_valuation
node_server -->|"computes analysis"| node_analysis
node_server -->|"scores portfolio"| node_serverhealth
node_server -->|"computes tax"| node_income
node_server -->|"refreshes rates"| node_fx
node_server -->|"refreshes quotes"| node_prices
node_server -->|"refreshes bullion"| node_metals
node_server -->|"refreshes bonds"| node_bonds

click node_app "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/app.js"
click node_api "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/api.js"
click node_ui "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/ui.js"
click node_format "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/format.js"
click node_charts "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/charts.js"
click node_offline "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/offline.js"
click node_holdings "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/holdings.js"
click node_dashboard "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/dashboard.js"
click node_analytics "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/analytics.js"
click node_allocation "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/allocation.js"
click node_health "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/health.js"
click node_goals "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/goals.js"
click node_planner "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/planner.js"
click node_planning "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/planning.js"
click node_tax "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/tax.js"
click node_profile "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/profile.js"
click node_settings "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/settings.js"
click node_reportview "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/report.js"
click node_server "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server.js"
click node_valuation "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/valuation.js"
click node_analysis "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/analysis.js"
click node_income "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/income.js"
click node_serverhealth "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/health.js"
click node_report "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/report.js"
click node_pdf "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/pdf.js"
click node_store "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/store.js"
click node_backups "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/backups.js"
click node_fx "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/fx.js"
click node_prices "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/prices.js"
click node_metals "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/metals.js"
click node_bonds "https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/bonds.js"

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_api,node_ui,node_format,node_charts,node_offline,node_user,node_browser toneBlue
class node_holdings,node_dashboard,node_analytics,node_allocation,node_health,node_goals,node_planner,node_planning,node_tax,node_profile,node_settings,node_reportview toneAmber
class node_server,node_valuation,node_analysis,node_income,node_serverhealth,node_report,node_pdf toneMint
class node_store,node_backups,node_fx,node_prices,node_metals,node_bonds toneRose
class node_publicfeeds toneIndigo
```

## Components

### Browser experience

- [App controller](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/app.js): `public/js/app.js`
- [API client](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/api.js): `public/js/api.js`
- [UI helpers](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/ui.js): `public/js/ui.js`
- [Formatting](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/format.js): `public/js/format.js`
- [Charts](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/charts.js): `public/js/charts.js`
- [Offline snapshot](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/offline.js): `public/js/offline.js`

### Portfolio analysis

- [Holdings](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/holdings.js): `public/js/views/holdings.js`
- [Dashboard](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/dashboard.js): `public/js/views/dashboard.js`
- [Wealth analytics](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/analytics.js): `public/js/views/analytics.js`
- [Allocation](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/allocation.js): `public/js/views/allocation.js`
- [Portfolio health](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/health.js): `public/js/views/health.js`
- [Goals](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/goals.js): `public/js/views/goals.js`
- [Retirement planner](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/planner.js): `public/js/views/planner.js`
- [Projection engine](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/planning.js): `public/js/planning.js`
- [India tax](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/tax.js): `public/js/views/tax.js`
- [Profile](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/profile.js): `public/js/views/profile.js`
- [Settings and backups](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/settings.js): `public/js/views/settings.js`
- [Report controls](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/public/js/views/report.js): `public/js/views/report.js`

### Local service

- [HTTP service](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server.js): `server.js`
- [Valuation](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/valuation.js): `server/lib/valuation.js`
- [Returns and allocation](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/analysis.js): `server/lib/analysis.js`
- [Income and tax](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/income.js): `server/lib/income.js`
- [Health scoring](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/health.js): `server/lib/health.js`
- [Report assembly](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/report.js): `server/lib/report.js`
- [PDF generation](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/pdf.js): `server/lib/pdf.js`

### Persistence and feeds

- [Ledger store](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/store.js): `server/lib/store.js`
- [Backup manager](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/backups.js): `server/lib/backups.js`
- [FX rates](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/fx.js): `server/lib/fx.js`
- [Equity prices](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/prices.js): `server/lib/prices.js`
- [Bullion rates](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/metals.js): `server/lib/metals.js`
- [Bond prices](https://github.com/ferdinjoe/indian-wealth-portfolio/blob/main/server/lib/bonds.js): `server/lib/bonds.js`

### Other components

- **Ledger user**
- **Web browser**
- **Public market sources**

## Connections

- Ledger user → Web browser: uses (evidence: `README.md`)
- Web browser → App controller: loads app (evidence: `README.md`)
- App controller → API client: requests state (evidence: `public/js/app.js`)
- App controller → Holdings: renders (evidence: `public/js/app.js`)
- App controller → Dashboard: renders (evidence: `public/js/app.js`)
- App controller → Wealth analytics: renders (evidence: `public/js/app.js`)
- App controller → Allocation: renders (evidence: `public/js/app.js`)
- App controller → Portfolio health: renders (evidence: `public/js/app.js`)
- App controller → Goals: renders (evidence: `public/js/app.js`)
- App controller → Retirement planner: renders (evidence: `public/js/app.js`)
- App controller → India tax: renders (evidence: `public/js/app.js`)
- App controller → Profile: renders (evidence: `public/js/app.js`)
- App controller → Settings and backups: renders (evidence: `public/js/app.js`)
- App controller → Report controls: renders (evidence: `public/js/app.js`)
- App controller → UI helpers: shows feedback (evidence: `public/js/app.js`)
- App controller → Formatting: formats totals (evidence: `public/js/app.js`)
- App controller → Charts: clears charts (evidence: `public/js/app.js`)
- App controller → Offline snapshot: saves snapshot (evidence: `public/js/app.js`)
- API client → HTTP service: HTTP requests (evidence: `public/js/api.js`)
- Holdings → API client: edits positions (evidence: `public/js/views/holdings.js`)
- Holdings → UI helpers: uses forms (evidence: `public/js/views/holdings.js`)
- Holdings → Formatting: formats values (evidence: `public/js/views/holdings.js`)
- Dashboard → Projection engine: uses projections (evidence: `public/js/views/dashboard.js`)
- Dashboard → Charts: plots data (evidence: `public/js/views/dashboard.js`)
- Wealth analytics → Projection engine: projects assets (evidence: `public/js/views/analytics.js`)
- Wealth analytics → Charts: plots data (evidence: `public/js/views/analytics.js`)
- Allocation → API client: reads state (evidence: `public/js/views/allocation.js`)
- Allocation → Charts: plots allocation (evidence: `public/js/views/allocation.js`)
- Portfolio health → Charts: plots scores (evidence: `public/js/views/health.js`)
- Goals → API client: manages goals (evidence: `public/js/views/goals.js`)
- Retirement planner → Projection engine: builds plan (evidence: `public/js/views/planner.js`)
- Retirement planner → API client: saves assumptions (evidence: `public/js/views/planner.js`)
- Retirement planner → Charts: plots projections (evidence: `public/js/views/planner.js`)
- India tax → API client: reads state (evidence: `public/js/views/tax.js`)
- Profile → API client: updates profile (evidence: `public/js/views/profile.js`)
- Settings and backups → API client: manages data (evidence: `public/js/views/settings.js`)
- Settings and backups → Offline snapshot: clears snapshot (evidence: `public/js/views/settings.js`)
- Report controls → API client: requests report (evidence: `public/js/views/report.js`)
- HTTP service → Ledger store: loads and saves (evidence: `server.js`)
- HTTP service → Backup manager: manages copies (evidence: `server.js`)
- HTTP service → Valuation: computes values (evidence: `server.js`)
- HTTP service → Returns and allocation: computes analysis (evidence: `server.js`)
- HTTP service → Health scoring: scores portfolio (evidence: `server.js`)
- HTTP service → Income and tax: computes tax (evidence: `server.js`)
- HTTP service → FX rates: refreshes rates (evidence: `server.js`)
- HTTP service → Equity prices: refreshes quotes (evidence: `server.js`)
- HTTP service → Bullion rates: refreshes bullion (evidence: `server.js`)
- HTTP service → Bond prices: refreshes bonds (evidence: `server.js`)
