# himanshuj9/stockscreenerapp architecture

> Architecture diagram of the GitHub repository himanshuj9/stockscreenerapp, 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/himanshuj9/stockscreenerapp
- Repository: https://github.com/himanshuj9/stockscreenerapp

## Overview

Stock Screener is a full-stack Indian-stock research application. Users search for a company, open its dashboard, and view live market fundamentals alongside stored company information, financial results, balance sheets, and shareholding. The React app calls the FastAPI service; the company endpoint queries SQLAlchemy-backed MySQL data and fetches current market data from Yahoo Finance. The README also documents ratios as a capability. Source excerpts establish the main route and query relationships; unsampled model details and other UI components are represented by their indexed files, without asserting additional call paths.

Main entry points: [`backend/app/routers/company.py`](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/routers/company.py) (Company endpoints), [`UI/src/App.tsx`](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/App.tsx) (Route application), [`UI/src/pages/Home/Home.tsx`](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/pages/Home/Home.tsx) (Home page), [`UI/src/pages/Company/Company.tsx`](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/pages/Company/Company.tsx) (Company dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React interface"]
  node_app["Route application<br/>[App.tsx]"]
  node_home["Home page<br/>[Home.tsx]"]
  node_hero["Search hero<br/>[Hero.tsx]"]
  node_navbar["Navigation bar<br/>[Navbar.tsx]"]
  node_dashboard["Company dashboard<br/>[Company.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_service["API service"]
  node_fastapi["FastAPI application<br/>[main.py]"]
  node_company_api["Company endpoints<br/>[company.py]"]
end

subgraph group_market["Market data"]
  node_market_service["Market data service<br/>[market_data.py]"]
end

subgraph group_storage["Persistence"]
  node_db_session["Database session<br/>[database.py]"]
  node_company_model["Company records<br/>[company.py]"]
  node_information_model["Company information"]
  node_financial_model["Financial results"]
  node_metric_model["Financial metrics<br/>[metric.py]"]
  node_balance_model["Balance sheets<br/>[balance_sheet.py]"]
  node_shareholding_model["Shareholding patterns<br/>[shareholding.py]"]
  node_ratio_model["Ratio records<br/>[ratio.py]"]
end

node_user(("Stock researcher"))
node_yahoo["Yahoo Finance"]
node_mysql[("MySQL database")]

node_user -->|"opens app"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_navbar
node_hero -->|"searches through"| node_api_client
node_dashboard -->|"loads and searches through"| node_api_client
node_api_client -->|"requests search and company data"| node_company_api
node_fastapi -->|"registers routes"| node_company_api
node_fastapi -->|"checks database health"| node_db_session
node_company_api -->|"obtains sessions"| node_db_session
node_company_api -->|"fetches market data"| node_market_service
node_market_service -->|"fetches quotes and fundamentals"| node_yahoo
node_db_session -->|"connects to"| node_mysql
node_company_api -->|"queries"| node_company_model
node_company_api -->|"queries"| node_information_model
node_company_api -->|"queries"| node_financial_model
node_company_api -->|"joins results with"| node_metric_model
node_company_api -->|"queries"| node_balance_model
node_company_api -->|"queries"| node_shareholding_model
node_dashboard -->|"displays returned dashboard data"| node_company_api

click node_app "https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/App.tsx"
click node_home "https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/pages/Home/Home.tsx"
click node_hero "https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/components/Hero/Hero.tsx"
click node_navbar "https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/components/Navbar/Navbar.tsx"
click node_dashboard "https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/pages/Company/Company.tsx"
click node_api_client "https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/services/api.ts"
click node_fastapi "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/main.py"
click node_company_api "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/routers/company.py"
click node_market_service "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/services/market_data.py"
click node_db_session "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/database.py"
click node_company_model "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/company.py"
click node_information_model "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/company_information.py"
click node_financial_model "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/financial_result.py"
click node_metric_model "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/metric.py"
click node_balance_model "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/balance_sheet.py"
click node_shareholding_model "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/shareholding.py"
click node_ratio_model "https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/ratio.py"

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_home,node_hero,node_navbar,node_dashboard,node_api_client toneBlue
class node_fastapi,node_company_api,node_mysql toneAmber
class node_market_service toneMint
class node_db_session,node_company_model,node_information_model,node_financial_model,node_metric_model,node_balance_model,node_shareholding_model,node_ratio_model toneRose
class node_user,node_yahoo toneIndigo
```

## Components

### React interface

- [Route application](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/App.tsx): `UI/src/App.tsx`
- [Home page](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/pages/Home/Home.tsx): `UI/src/pages/Home/Home.tsx`
- [Search hero](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/components/Hero/Hero.tsx): `UI/src/components/Hero/Hero.tsx`
- [Navigation bar](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/components/Navbar/Navbar.tsx): `UI/src/components/Navbar/Navbar.tsx`
- [Company dashboard](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/pages/Company/Company.tsx): `UI/src/pages/Company/Company.tsx`
- [API client](https://github.com/himanshuj9/stockscreenerapp/blob/main/UI/src/services/api.ts): `UI/src/services/api.ts`

### API service

- [FastAPI application](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/main.py): `backend/app/main.py`
- [Company endpoints](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/routers/company.py): `backend/app/routers/company.py`

### Market data

- [Market data service](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/services/market_data.py): `backend/app/services/market_data.py`

### Persistence

- [Database session](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/database.py): `backend/app/database.py`
- [Company records](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/company.py): `backend/app/models/company.py`
- [Company information](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/company_information.py): `backend/app/models/company_information.py`
- [Financial results](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/financial_result.py): `backend/app/models/financial_result.py`
- [Financial metrics](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/metric.py): `backend/app/models/metric.py`
- [Balance sheets](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/balance_sheet.py): `backend/app/models/balance_sheet.py`
- [Shareholding patterns](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/shareholding.py): `backend/app/models/shareholding.py`
- [Ratio records](https://github.com/himanshuj9/stockscreenerapp/blob/main/backend/app/models/ratio.py): `backend/app/models/ratio.py`

### Other components

- **Stock researcher**
- **Yahoo Finance**
- **MySQL database**

## Connections

- Stock researcher → Route application: opens app (evidence: `README.md`)
- Route application → Home page: routes to (evidence: `UI/src/App.tsx`)
- Route application → Company dashboard: routes to (evidence: `UI/src/App.tsx`)
- Home page → Search hero: renders (evidence: `UI/src/pages/Home/Home.tsx`)
- Home page → Navigation bar: renders (evidence: `UI/src/pages/Home/Home.tsx`)
- Search hero → API client: searches through (evidence: `UI/src/components/Hero/Hero.tsx`)
- Company dashboard → API client: loads and searches through (evidence: `UI/src/pages/Company/Company.tsx`)
- API client → Company endpoints: requests search and company data (evidence: `UI/src/services/api.ts`)
- FastAPI application → Company endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Database session: checks database health (evidence: `backend/app/main.py`)
- Company endpoints → Database session: obtains sessions (evidence: `backend/app/routers/company.py`)
- Company endpoints → Market data service: fetches market data (evidence: `backend/app/routers/company.py`)
- Market data service → Yahoo Finance: fetches quotes and fundamentals (evidence: `backend/app/services/market_data.py`)
- Database session → MySQL database: connects to (evidence: `backend/app/database.py`)
- Company endpoints → Company records: queries (evidence: `backend/app/routers/company.py`)
- Company endpoints → Company information: queries (evidence: `backend/app/routers/company.py`)
- Company endpoints → Financial results: queries (evidence: `backend/app/routers/company.py`)
- Company endpoints → Financial metrics: joins results with (evidence: `backend/app/routers/company.py`)
- Company endpoints → Balance sheets: queries (evidence: `backend/app/routers/company.py`)
- Company endpoints → Shareholding patterns: queries (evidence: `backend/app/routers/company.py`)
- Company dashboard → Company endpoints: displays returned dashboard data (evidence: `UI/src/pages/Company/Company.tsx`)
