# nandheswara/stock-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/nandheswara/stock-analysis
- Repository: https://github.com/nandheswara/stock-analysis

## Overview

Equity Labs is a browser-based workspace for Indian stock fundamental analysis and personal finance tracking. Users compare stock fundamentals from Groww and Yahoo Finance, or maintain a month-by-month finance ledger with assets, liabilities, insurance, and forecasts. Firebase provides authentication and cloud persistence. The graph includes the documented news, budgeting, portfolio, and account-management capabilities; their detailed wiring is not shown in the sampled source. Dashed edges mark the documented but unsampled live-data proxy connection.

Main entry points: [`js/firebase-finance-service.js`](https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-finance-service.js) (Finance service), [`js/services/finance/helpers.js`](https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/helpers.js) (Finance helpers), [`js/firebase-auth-service.js`](https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-auth-service.js) (Authentication), [`js/fetch.js`](https://github.com/nandheswara/stock-analysis/blob/main/js/fetch.js) (Market data fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Stock analysis"]
  node_analysis_ui["Analysis terminal<br/>[analysis.js]"]
  node_market_fetch["Market data fetch<br/>[fetch.js]"]
  node_proxy["CORS proxy<br/>[cors-proxy.js]"]
end

subgraph group_finance["Personal finance"]
  node_finance_ui["Finance tracker<br/>[finance-tracker.js]"]
  node_finance_api["Finance service"]
  node_banks["Bank accounts<br/>[banks.js]"]
  node_investments["Investment categories<br/>[investments.js]"]
  node_liabilities["Liabilities and insurance<br/>[liabilities.js]"]
  node_forecast["Financial forecast<br/>[forecast.js]"]
  node_health["Financial health score<br/>[health-score.js]"]
  node_finance_helpers["Finance helpers<br/>[helpers.js]"]
end

subgraph group_identity["Identity and storage"]
  node_auth["Authentication"]
  node_firebase_config["Firebase setup<br/>[firebase-config.js]"]
  node_stock_store["Stock data service"]
  node_portfolio_store["Portfolio service"]
  node_firebase_db[("Firebase Realtime Database")]
end

subgraph group_workspace["Workspace features"]
  node_budget["Budget planner<br/>[budget-planner.js]"]
  node_news["Financial news<br/>[news.js]"]
  node_admin["Administration<br/>[admin.js]"]
  node_profile["User profile<br/>[profile.js]"]
  node_stock_manager["Stock portfolio manager<br/>[stock-manager.js]"]
end

node_user(("User"))
node_groww["Groww"]
node_yahoo["Yahoo Finance"]

node_user -->|"analyzes stocks"| node_analysis_ui
node_analysis_ui -->|"requests metrics"| node_market_fetch
node_market_fetch -->|"fetches fundamentals"| node_groww
node_market_fetch -->|"fetches fundamentals"| node_yahoo
node_market_fetch -.->|"uses proxy"| node_proxy
node_user -->|"tracks finances"| node_finance_ui
node_finance_ui -->|"manages ledger"| node_finance_api
node_finance_ui -->|"generates forecast"| node_forecast
node_finance_api -->|"delegates bank operations"| node_banks
node_finance_api -->|"delegates investment operations"| node_investments
node_finance_api -->|"delegates liability operations"| node_liabilities
node_finance_api -->|"uses helpers"| node_finance_helpers
node_banks -->|"uses helpers"| node_finance_helpers
node_investments -->|"uses helpers"| node_finance_helpers
node_liabilities -->|"uses helpers"| node_finance_helpers
node_forecast -->|"reads finance data"| node_finance_api
node_health -->|"reads finance data"| node_finance_api
node_auth -->|"uses Firebase setup"| node_firebase_config
node_stock_store -->|"checks user"| node_auth
node_portfolio_store -->|"checks user"| node_auth
node_finance_helpers -->|"checks user"| node_auth
node_auth -->|"reads and writes"| node_firebase_db
node_stock_store -->|"stores stock data"| node_firebase_db
node_portfolio_store -->|"stores portfolio"| node_firebase_db
node_finance_helpers -->|"accesses finance records"| node_firebase_db
node_user -->|"plans budget"| node_budget
node_user -.->|"views financial news"| node_news
node_user -.->|"manages workspace"| node_admin
node_user -.->|"manages profile"| node_profile
node_user -->|"manages portfolio"| node_stock_manager
node_stock_manager -->|"loads portfolio"| node_portfolio_store
node_budget -->|"uses finance data"| node_finance_api

click node_analysis_ui "https://github.com/nandheswara/stock-analysis/blob/main/js/analysis.js"
click node_market_fetch "https://github.com/nandheswara/stock-analysis/blob/main/js/fetch.js"
click node_proxy "https://github.com/nandheswara/stock-analysis/blob/main/js/cors-proxy.js"
click node_finance_ui "https://github.com/nandheswara/stock-analysis/blob/main/js/finance-tracker.js"
click node_finance_api "https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-finance-service.js"
click node_banks "https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/banks.js"
click node_investments "https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/investments.js"
click node_liabilities "https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/liabilities.js"
click node_forecast "https://github.com/nandheswara/stock-analysis/blob/main/js/forecast.js"
click node_health "https://github.com/nandheswara/stock-analysis/blob/main/js/health-score.js"
click node_finance_helpers "https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/helpers.js"
click node_auth "https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-auth-service.js"
click node_firebase_config "https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-config.js"
click node_stock_store "https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-database-service.js"
click node_portfolio_store "https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-portfolio-service.js"
click node_budget "https://github.com/nandheswara/stock-analysis/blob/main/js/budget-planner.js"
click node_news "https://github.com/nandheswara/stock-analysis/blob/main/js/news.js"
click node_admin "https://github.com/nandheswara/stock-analysis/blob/main/js/admin.js"
click node_profile "https://github.com/nandheswara/stock-analysis/blob/main/js/profile.js"
click node_stock_manager "https://github.com/nandheswara/stock-analysis/blob/main/js/stock-manager.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_analysis_ui,node_market_fetch,node_proxy,node_user toneBlue
class node_finance_ui,node_finance_api,node_banks,node_investments,node_liabilities,node_forecast,node_health,node_finance_helpers toneAmber
class node_auth,node_firebase_config,node_stock_store,node_portfolio_store,node_firebase_db toneMint
class node_budget,node_news,node_admin,node_profile,node_stock_manager toneRose
class node_groww,node_yahoo toneIndigo
```

## Components

### Stock analysis

- [Analysis terminal](https://github.com/nandheswara/stock-analysis/blob/main/js/analysis.js): `js/analysis.js`
- [Market data fetch](https://github.com/nandheswara/stock-analysis/blob/main/js/fetch.js): `js/fetch.js`
- [CORS proxy](https://github.com/nandheswara/stock-analysis/blob/main/js/cors-proxy.js): `js/cors-proxy.js`

### Personal finance

- [Finance tracker](https://github.com/nandheswara/stock-analysis/blob/main/js/finance-tracker.js): `js/finance-tracker.js`
- [Finance service](https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-finance-service.js): `js/firebase-finance-service.js`
- [Bank accounts](https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/banks.js): `js/services/finance/banks.js`
- [Investment categories](https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/investments.js): `js/services/finance/investments.js`
- [Liabilities and insurance](https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/liabilities.js): `js/services/finance/liabilities.js`
- [Financial forecast](https://github.com/nandheswara/stock-analysis/blob/main/js/forecast.js): `js/forecast.js`
- [Financial health score](https://github.com/nandheswara/stock-analysis/blob/main/js/health-score.js): `js/health-score.js`
- [Finance helpers](https://github.com/nandheswara/stock-analysis/blob/main/js/services/finance/helpers.js): `js/services/finance/helpers.js`

### Identity and storage

- [Authentication](https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-auth-service.js): `js/firebase-auth-service.js`
- [Firebase setup](https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-config.js): `js/firebase-config.js`
- [Stock data service](https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-database-service.js): `js/firebase-database-service.js`
- [Portfolio service](https://github.com/nandheswara/stock-analysis/blob/main/js/firebase-portfolio-service.js): `js/firebase-portfolio-service.js`
- **Firebase Realtime Database**

### Workspace features

- [Budget planner](https://github.com/nandheswara/stock-analysis/blob/main/js/budget-planner.js): `js/budget-planner.js`
- [Financial news](https://github.com/nandheswara/stock-analysis/blob/main/js/news.js): `js/news.js`
- [Administration](https://github.com/nandheswara/stock-analysis/blob/main/js/admin.js): `js/admin.js`
- [User profile](https://github.com/nandheswara/stock-analysis/blob/main/js/profile.js): `js/profile.js`
- [Stock portfolio manager](https://github.com/nandheswara/stock-analysis/blob/main/js/stock-manager.js): `js/stock-manager.js`

### Other components

- **User**
- **Groww**
- **Yahoo Finance**

## Connections

- User → Analysis terminal: analyzes stocks (evidence: `README.md`)
- Analysis terminal → Market data fetch: requests metrics (evidence: `js/analysis.js`)
- Market data fetch → Groww: fetches fundamentals (evidence: `README.md`)
- Market data fetch → Yahoo Finance: fetches fundamentals (evidence: `README.md`)
- Market data fetch → CORS proxy: uses proxy (evidence: `README.md`)
- User → Finance tracker: tracks finances (evidence: `README.md`)
- Finance tracker → Finance service: manages ledger (evidence: `js/finance-tracker.js`)
- Finance tracker → Financial forecast: generates forecast (evidence: `js/finance-tracker.js`)
- Finance service → Bank accounts: delegates bank operations (evidence: `js/firebase-finance-service.js`)
- Finance service → Investment categories: delegates investment operations (evidence: `js/firebase-finance-service.js`)
- Finance service → Liabilities and insurance: delegates liability operations (evidence: `js/firebase-finance-service.js`)
- Finance service → Finance helpers: uses helpers
- Bank accounts → Finance helpers: uses helpers (evidence: `js/services/finance/banks.js`)
- Investment categories → Finance helpers: uses helpers (evidence: `js/services/finance/investments.js`)
- Liabilities and insurance → Finance helpers: uses helpers (evidence: `js/services/finance/liabilities.js`)
- Financial forecast → Finance service: reads finance data (evidence: `js/forecast.js`)
- Financial health score → Finance service: reads finance data (evidence: `js/health-score.js`)
- Authentication → Firebase setup: uses Firebase setup (evidence: `js/firebase-auth-service.js`)
- Stock data service → Authentication: checks user (evidence: `js/firebase-database-service.js`)
- Portfolio service → Authentication: checks user (evidence: `js/firebase-portfolio-service.js`)
- Finance helpers → Authentication: checks user (evidence: `js/services/finance/helpers.js`)
- Authentication → Firebase Realtime Database: reads and writes (evidence: `js/firebase-auth-service.js`)
- Stock data service → Firebase Realtime Database: stores stock data (evidence: `js/firebase-database-service.js`)
- Portfolio service → Firebase Realtime Database: stores portfolio (evidence: `js/firebase-portfolio-service.js`)
- Finance helpers → Firebase Realtime Database: accesses finance records (evidence: `js/services/finance/helpers.js`)
- User → Budget planner: plans budget (evidence: `README.md`)
- User → Financial news: views financial news
- User → Administration: manages workspace
- User → User profile: manages profile
- User → Stock portfolio manager: manages portfolio (evidence: `README.md`)
- Stock portfolio manager → Portfolio service: loads portfolio (evidence: `js/stock-manager.js`)
- Budget planner → Finance service: uses finance data (evidence: `js/budget-planner.js`)
