# nikunjpurohit11/hcltech-stocker architecture

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

- Interactive diagram: https://gitdiagram.com/nikunjpurohit11/hcltech-stocker
- Repository: https://github.com/nikunjpurohit11/hcltech-stocker

## Overview

This repository is a quantitative investing dashboard backed by a FastAPI analytics service. The user enters through the React application, explores market and stock data, and can inspect portfolio, risk, prediction, and strategy results. The frontend currently includes mock-data services alongside Supabase-backed account and portfolio functionality; prediction and backtesting capabilities also have backend implementations. Many routes and pages are documented by the source index but were not excerpted, so their internal call chains are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/App.tsx) (Application router), [`src/pages/StockAnalysisPage.tsx`](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/StockAnalysisPage.tsx) (Stock analysis), [`src/services/portfolioService.ts`](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/portfolioService.ts) (Portfolio service), [`backend/app/api/routes/__init__.py`](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/api/routes/__init__.py) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_webapp["Application router<br/>[App.tsx]"]
  node_stockpage["Stock analysis"]
  node_dashboard["Portfolio dashboard<br/>[DashboardPage.tsx]"]
  node_riskpage["Risk analytics"]
  node_strategy["Strategy lab"]
  node_insights["AI insights<br/>[AIInsightsPage.tsx]"]
end

subgraph group_market["Market data"]
  node_marketservice["Market service<br/>[marketService.ts]"]
  node_mockmarket["Market fixtures<br/>[mockStocks.ts]"]
  node_marketcharts["Market charts<br/>[PriceChart.tsx]"]
end

subgraph group_portfolio["Portfolio and accounts"]
  node_portfolioservice["Portfolio service"]
  node_transactions["Transactions"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_supabase[("Supabase<br/>[supabase.ts]")]
  node_calculations["Financial calculations"]
end

subgraph group_research["Analytics and research"]
  node_riskservice["Risk analytics service"]
  node_predictionclient["Prediction service"]
  node_strategyservice["Backtest client<br/>[strategyService.ts]"]
  node_api["API client<br/>[apiClient.ts]"]
end

subgraph group_backend["Analytics API"]
  node_server["FastAPI application<br/>[main.py]"]
  node_routes["API routes<br/>[__init__.py]"]
  node_predictionbackend["Prediction inference"]
  node_features["Feature engineering"]
  node_provider["Market data provider<br/>[market_data.py]"]
  node_yahoo["Yahoo Finance<br/>[yahoo_finance.py]"]
  node_backtestbackend["Backtesting service"]
  node_riskbackend["Risk service<br/>[risk_service.py]"]
  node_analyticsbackend["Analytics service"]
end

node_investor(("Investor"))

node_investor -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_stockpage
node_webapp -->|"routes to"| node_dashboard
node_webapp -->|"routes to"| node_riskpage
node_webapp -->|"routes to"| node_strategy
node_webapp -->|"routes to"| node_insights
node_webapp -->|"loads market data"| node_marketservice
node_stockpage -->|"requests history"| node_marketservice
node_stockpage -->|"requests prediction"| node_predictionclient
node_stockpage -->|"renders chart"| node_marketcharts
node_marketservice -->|"loads fixtures"| node_mockmarket
node_marketcharts -->|"formats values"| node_calculations
node_dashboard -->|"loads portfolio"| node_portfolioservice
node_dashboard -->|"loads activity"| node_transactions
node_portfolioservice -->|"calculates PnL"| node_calculations
node_portfolioservice -->|"reads and writes"| node_supabase
node_portfolioservice -->|"gets quotes"| node_marketservice
node_auth -->|"authenticates and seeds"| node_supabase
node_riskpage -.->|"requests analytics"| node_riskservice
node_strategy -->|"runs backtest"| node_strategyservice
node_predictionclient -->|"requests prediction"| node_api
node_strategyservice -->|"requests backtest"| node_api
node_api -.->|"calls API"| node_server
node_server -->|"registers routes"| node_routes
node_server -->|"loads artifacts"| node_predictionbackend
node_predictionbackend -->|"computes features"| node_features
node_predictionbackend -->|"fetches market data"| node_provider
node_provider -->|"uses provider"| node_yahoo
node_routes -.->|"dispatches backtests"| node_backtestbackend
node_routes -.->|"dispatches risk"| node_riskbackend
node_routes -.->|"dispatches analytics"| node_analyticsbackend

click node_webapp "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/App.tsx"
click node_stockpage "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/StockAnalysisPage.tsx"
click node_dashboard "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/DashboardPage.tsx"
click node_riskpage "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/RiskAnalyticsPage.tsx"
click node_strategy "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/StrategyLabPage.tsx"
click node_insights "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/AIInsightsPage.tsx"
click node_marketservice "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/marketService.ts"
click node_mockmarket "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/data/mockStocks.ts"
click node_marketcharts "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/components/charts/PriceChart.tsx"
click node_portfolioservice "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/portfolioService.ts"
click node_transactions "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/transactionService.ts"
click node_auth "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/context/AuthContext.tsx"
click node_supabase "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/lib/supabase.ts"
click node_calculations "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/utils/financialCalculations.ts"
click node_riskservice "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/analyticsService.ts"
click node_predictionclient "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/predictionService.ts"
click node_strategyservice "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/strategyService.ts"
click node_api "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/apiClient.ts"
click node_server "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/main.py"
click node_routes "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/api/routes/__init__.py"
click node_predictionbackend "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/prediction_service.py"
click node_features "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/feature_engineering.py"
click node_provider "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/providers/market_data.py"
click node_yahoo "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/providers/yahoo_finance.py"
click node_backtestbackend "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/backtest_service.py"
click node_riskbackend "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/risk_service.py"
click node_analyticsbackend "https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/analytics_service.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_webapp,node_stockpage,node_dashboard,node_riskpage,node_strategy,node_insights toneBlue
class node_marketservice,node_mockmarket,node_marketcharts toneAmber
class node_portfolioservice,node_transactions,node_auth,node_supabase,node_calculations toneMint
class node_riskservice,node_predictionclient,node_strategyservice,node_api toneRose
class node_server,node_routes,node_predictionbackend,node_features,node_provider,node_yahoo,node_backtestbackend,node_riskbackend,node_analyticsbackend,node_investor toneIndigo
```

## Components

### Web application

- [Application router](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/App.tsx): `src/App.tsx`
- [Stock analysis](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/StockAnalysisPage.tsx): `src/pages/StockAnalysisPage.tsx`
- [Portfolio dashboard](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Risk analytics](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/RiskAnalyticsPage.tsx): `src/pages/RiskAnalyticsPage.tsx`
- [Strategy lab](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/StrategyLabPage.tsx): `src/pages/StrategyLabPage.tsx`
- [AI insights](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/pages/AIInsightsPage.tsx): `src/pages/AIInsightsPage.tsx`

### Market data

- [Market service](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/marketService.ts): `src/services/marketService.ts`
- [Market fixtures](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/data/mockStocks.ts): `src/data/mockStocks.ts`
- [Market charts](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/components/charts/PriceChart.tsx): `src/components/charts/PriceChart.tsx`

### Portfolio and accounts

- [Portfolio service](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/portfolioService.ts): `src/services/portfolioService.ts`
- [Transactions](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/transactionService.ts): `src/services/transactionService.ts`
- [Authentication](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Supabase](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Financial calculations](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/utils/financialCalculations.ts): `src/utils/financialCalculations.ts`

### Analytics and research

- [Risk analytics service](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/analyticsService.ts): `src/services/analyticsService.ts`
- [Prediction service](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/predictionService.ts): `src/services/predictionService.ts`
- [Backtest client](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/strategyService.ts): `src/services/strategyService.ts`
- [API client](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/src/services/apiClient.ts): `src/services/apiClient.ts`

### Analytics API

- [FastAPI application](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/main.py): `backend/app/main.py`
- [API routes](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/api/routes/__init__.py): `backend/app/api/routes/__init__.py`
- [Prediction inference](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/prediction_service.py): `backend/app/services/prediction_service.py`
- [Feature engineering](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/feature_engineering.py): `backend/app/services/feature_engineering.py`
- [Market data provider](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/providers/market_data.py): `backend/app/providers/market_data.py`
- [Yahoo Finance](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/providers/yahoo_finance.py): `backend/app/providers/yahoo_finance.py`
- [Backtesting service](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/backtest_service.py): `backend/app/services/backtest_service.py`
- [Risk service](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/risk_service.py): `backend/app/services/risk_service.py`
- [Analytics service](https://github.com/nikunjpurohit11/hcltech-stocker/blob/main/backend/app/services/analytics_service.py): `backend/app/services/analytics_service.py`

### Other components

- **Investor**

## Connections

- Investor → Application router: uses
- Application router → Stock analysis: routes to (evidence: `src/App.tsx`)
- Application router → Portfolio dashboard: routes to (evidence: `src/App.tsx`)
- Application router → Risk analytics: routes to (evidence: `src/App.tsx`)
- Application router → Strategy lab: routes to (evidence: `src/App.tsx`)
- Application router → AI insights: routes to (evidence: `src/App.tsx`)
- Application router → Market service: loads market data (evidence: `src/App.tsx`)
- Stock analysis → Market service: requests history (evidence: `src/pages/StockAnalysisPage.tsx`)
- Stock analysis → Prediction service: requests prediction (evidence: `src/pages/StockAnalysisPage.tsx`)
- Stock analysis → Market charts: renders chart (evidence: `src/pages/StockAnalysisPage.tsx`)
- Market service → Market fixtures: loads fixtures (evidence: `src/services/marketService.ts`)
- Market charts → Financial calculations: formats values (evidence: `src/components/charts/PriceChart.tsx`)
- Portfolio dashboard → Portfolio service: loads portfolio (evidence: `src/pages/DashboardPage.tsx`)
- Portfolio dashboard → Transactions: loads activity (evidence: `src/pages/DashboardPage.tsx`)
- Portfolio service → Financial calculations: calculates PnL (evidence: `src/services/portfolioService.ts`)
- Portfolio service → Supabase: reads and writes (evidence: `src/services/portfolioService.ts`)
- Portfolio service → Market service: gets quotes (evidence: `src/services/portfolioService.ts`)
- Authentication → Supabase: authenticates and seeds (evidence: `src/context/AuthContext.tsx`)
- Risk analytics → Risk analytics service: requests analytics
- Strategy lab → Backtest client: runs backtest (evidence: `src/pages/StrategyLabPage.tsx`)
- Prediction service → API client: requests prediction (evidence: `src/services/predictionService.ts`)
- Backtest client → API client: requests backtest (evidence: `src/services/strategyService.ts`)
- API client → FastAPI application: calls API
- FastAPI application → API routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Prediction inference: loads artifacts (evidence: `backend/app/main.py`)
- Prediction inference → Feature engineering: computes features (evidence: `backend/app/services/prediction_service.py`)
- Prediction inference → Market data provider: fetches market data (evidence: `backend/app/services/prediction_service.py`)
- Market data provider → Yahoo Finance: uses provider (evidence: `backend/app/providers/market_data.py`)
- API routes → Backtesting service: dispatches backtests
- API routes → Risk service: dispatches risk
- API routes → Analytics service: dispatches analytics
