# ishaanmukeshpatil-ui/indian-stock-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/ishaanmukeshpatil-ui/indian-stock-analyzer
- Repository: https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer

## Overview

This repository is a frontend-first stock analysis application, built primarily as a React single-page app and organized around three user-facing analysis areas: current market situation, historical analysis, and an AI chatbot. The codebase also includes deployment/configuration files for static hosting and a few legacy/static HTML-CSS-JS copies of the app, which suggests the project has been adapted for multiple hosting paths.

Overall architecture
- Primary runtime: React app under `src/`, likely bundled with Vite.
- Presentation layer: reusable UI components for navigation, charts, modals, watchlists, and data display.
- Page layer: three top-level screens in `src/pages/`:
  - `CurrentSituation.jsx`
  - `HistoryAnalysis.jsx`
  - `AIChatbot.jsx`
- Service layer: API wrappers in `src/services/` that isolate data fetching and AI calls.
- Shared utilities: formatting and constant definitions in `src/utils/`.
- Deployment targets: Netlify and Vercel configs are present, indicating static hosting / SPA deployment.

Main subsystems

1. App shell and layout
- `src/main.jsx` and `src/App.jsx` are the React entry point and application composition root.
- `src/components/Layout.jsx`, `Header.jsx`, and `Sidebar.jsx` define the common shell around pages.
- `DropdownItem.jsx`, `Modal.jsx`, `SourceLink.jsx`, and `DataWindow.jsx` are supporting interface elements.
- `Watchlist.jsx` indicates a persistent or semi-persistent user-selected stock list inside the app shell.

Architectural role:
- This layer controls global navigation and page composition.
- It likely routes or conditionally renders the three major pages while keeping the sidebar/header consistent.

2. Analysis pages
- `CurrentSituation.jsx` appears to present live or near-real-time market state for a chosen stock or group of stocks.
- `HistoryAnalysis.jsx` appears to present longer-term or past performance analysis.
- `AIChatbot.jsx` is a conversational analysis surface that likely summarizes stock-related information using an LLM.

Architectural role:
- These pages are the main business-facing units.
- Each page likely orchestrates data loading, transforms, and chart/widget composition through the shared service and component layers.

3. Visualization and data presentation
- `CandlestickChart.jsx` and `QuarterlyChart.jsx` are the main charting components.
- These are likely fed by historical price/financial data returned from `stockService`.
- `DataWindow.jsx` likely shows structured numeric/statistical summaries.
- `Watchlist.jsx` supports stock selection and quick switching between instruments.

Architectural role:
- Chart components are isolated from data retrieval; they only receive prepared data and render visual output.
- This separation makes the diagram clean: pages fetch/orchestrate, components render.

4. Service boundary
- `src/services/apiClient.js` is the low-level network layer.
- `src/services/stockService.js` wraps stock/market data access.
- `src/services/geminiService.js` wraps AI/LLM calls.

Architectural role:
- `apiClient.js` is the foundation for all outbound HTTP calls.
- `stockService.js` is the domain-specific adapter for market data.
- `geminiService.js` is the domain-specific adapter for AI responses.
- This is the key external integration boundary in the repo.

Likely external dependencies / integrations
- Market/stock data provider: accessed through `stockService`; the exact vendor is not visible in the tree, but it is clearly an external API boundary.
- Google Gemini: strongly implied by `geminiService.js`, used by the chatbot page.
- Static hosting/CDN: indicated by `netlify.toml` and `vercel.json`.

5. Utilities and shared definitions
- `src/utils/constants.js` contains application-wide constants.
- `src/utils/formatters.js` likely standardizes numbers, dates, currency, percentages, and display labels.

Architectural role:
- These utilities keep formatting and shared configuration out of the UI and service layers.
- They are used across pages/components to keep displays consistent.

Repository shape and duplication
There are multiple top-level HTML/CSS/JS artifacts outside `src/`:
- root `index.html`, `script.js`, `styles.css`
- `public/index.html`, `public/script.js`, `public/styles.css`, `public/test-locally.html`
- `ishaanthecreator/index.html`, `ishaanthecreator/script.js`, `ishaanthecreator/styles.css`
- `test-locally.html`

This suggests one of two patterns:
- The repo contains a newer React/Vite app plus older static prototypes or deployment copies.
- Or it contains multiple hosting targets / exported versions of the same UI.

For architecture diagram purposes, treat these as ancillary delivery artifacts rather than the core application logic. The canonical source of the app is the `src/` tree.

Data flow summary
1. User enters the app through the shell (`App.jsx` + `Layout.jsx`).
2. The shell provides navigation to the main pages:
   - current situation
   - history analysis
   - AI chatbot
3. A page requests domain data through a service:
   - stock-related data via `stockService`
   - AI-generated content via `geminiService`
4. Services rely on `apiClient` to make outbound calls.
5. Returned data is normalized and formatted using `formatters` and `constants`.
6. UI components render charts, summary windows, watchlists, and modals.
7. Supporting elements like `SourceLink` likely expose data provenance or external references to the user.

Important boundaries to show in a diagram
- UI boundary: React components/pages vs. service layer.
- Domain boundary: stock market analytics vs. AI chatbot functionality.
- External boundary: internal app vs. third-party APIs.
- Deployment boundary: source app under `src/` vs. static hosting artifacts/configuration.

Technologies that materially affect the architecture
- React: component-driven frontend architecture.
- Vite: build/dev tooling for the React app.
- Static hosting configs: Netlify and Vercel indicate the app is designed to be deployed as a client-side SPA.
- Tailwind config exists, so styling likely uses Tailwind alongside component CSS.
- Plain HTML/CSS/JS files exist, indicating a fallback or legacy path that may matter for deployment history but not for the main app architecture.

In short, this is a modular React SPA for stock analysis, split into:
- a reusable shell and navigation layer,
- page-specific analysis surfaces,
- a chart/data display component layer,
- a service layer that isolates external stock and AI APIs,
- and shared formatting/configuration utilities.

Main entry points: [`src/components/Layout.jsx`](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/Layout.jsx) (Layout), [`src/pages/CurrentSituation.jsx`](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/pages/CurrentSituation.jsx) (Current View), [`src/pages/HistoryAnalysis.jsx`](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/pages/HistoryAnalysis.jsx) (History View), [`src/App.jsx`](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/App.jsx) (App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph "React App"
  main["Entry<br/>[main.jsx]"]
  app["App<br/>root shell<br/>[App.jsx]"]
  layout["Layout<br/>app shell<br/>[Layout.jsx]"]
  header["Header<br/>navigation<br/>[Header.jsx]"]
  sidebar["Sidebar<br/>navigation<br/>[Sidebar.jsx]"]
  watchlist["Watchlist<br/>selection panel<br/>[Watchlist.jsx]"]
  current["Current View<br/>analysis page"]
  history["History View<br/>analysis page"]
  chatbot["AI Chatbot<br/>analysis page<br/>[AIChatbot.jsx]"]
  candles["Candlestick<br/>chart component"]
  quarterly["Quarterly Chart<br/>chart component<br/>[QuarterlyChart.jsx]"]
  datawindow["Data Window<br/>summary panel<br/>[DataWindow.jsx]"]
  modal["Modal<br/>ui overlay<br/>[Modal.jsx]"]
  source["Source Link<br/>provenance link<br/>[SourceLink.jsx]"]
  api["API Client<br/>http layer<br/>[apiClient.js]"]
  stock["Stock Service<br/>market adapter<br/>[stockService.js]"]
  gemini["Gemini Service<br/>ai adapter<br/>[geminiService.js]"]
  formatters["Formatters<br/>display utils<br/>[formatters.js]"]
  constants["Constants<br/>config utils<br/>[constants.js]"]
end

subgraph "Delivery Artifacts"
  vite["Vite Build<br/>tooling config<br/>[vite.config.js]"]
  tailwind["Tailwind Config<br/>styling config<br/>[tailwind.config.js]"]
  netlify["Netlify<br/>deploy config<br/>[netlify.toml]"]
  vercel["Vercel<br/>deploy config<br/>[vercel.json]"]
  legacy["Legacy Static App<br/>static copy<br/>[index.html]"]
end

main -->|"mounts"| app
app -->|"wraps"| layout
layout -->|"includes"| header
layout -->|"includes"| sidebar
layout -->|"contains"| watchlist
layout -->|"navigates"| current
layout -->|"navigates"| history
layout -->|"navigates"| chatbot
current -->|"loads"| stock
history -->|"loads"| stock
chatbot -->|"queries"| gemini
stock -->|"uses"| api
gemini -->|"uses"| api
current -->|"renders"| candles
history -->|"renders"| quarterly
current -->|"renders"| datawindow
history -->|"renders"| datawindow
chatbot -->|"references"| source
current -->|"formats"| formatters
history -->|"formats"| formatters
chatbot -->|"configures"| constants
vite -.->|"builds"| main
tailwind -.->|"styles"| layout
netlify -.->|"deploys"| app
vercel -.->|"deploys"| app
legacy -.->|"mirrors"| app

click main "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/main.jsx"
click app "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/App.jsx"
click layout "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/Layout.jsx"
click header "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/Header.jsx"
click sidebar "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/Sidebar.jsx"
click watchlist "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/Watchlist.jsx"
click current "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/pages/CurrentSituation.jsx"
click history "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/pages/HistoryAnalysis.jsx"
click chatbot "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/pages/AIChatbot.jsx"
click candles "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/CandlestickChart.jsx"
click quarterly "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/QuarterlyChart.jsx"
click datawindow "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/DataWindow.jsx"
click modal "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/Modal.jsx"
click source "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/components/SourceLink.jsx"
click api "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/services/apiClient.js"
click stock "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/services/stockService.js"
click gemini "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/services/geminiService.js"
click formatters "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/utils/formatters.js"
click constants "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/src/utils/constants.js"
click vite "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/vite.config.js"
click tailwind "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/tailwind.config.js"
click netlify "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/netlify.toml"
click vercel "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/vercel.json"
click legacy "https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/main/public/index.html"

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 main,app,layout,header,sidebar,watchlist,current,history,chatbot,candles,quarterly,datawindow,modal,source,api,stock,gemini,formatters,constants toneBlue
class vite,tailwind,netlify,vercel,legacy toneAmber
```

## Components

### React App

Primary SPA source under src/

- [Entry](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/main.jsx): react entry · Bootstraps the app · `src/main.jsx`
- [App](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/App.jsx): root shell · Top-level composition and page selection · `src/App.jsx`
- [Layout](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/Layout.jsx): app shell · Shared page frame and navigation wrapper · `src/components/Layout.jsx`
- [Header](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/Header.jsx): navigation · Top bar and global actions · `src/components/Header.jsx`
- [Sidebar](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/Sidebar.jsx): navigation · Primary side navigation · `src/components/Sidebar.jsx`
- [Watchlist](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/Watchlist.jsx): selection panel · Pinned stock list and quick switching · `src/components/Watchlist.jsx`
- [Current View](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/pages/CurrentSituation.jsx): analysis page · Live market situation surface · `src/pages/CurrentSituation.jsx`
- [History View](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/pages/HistoryAnalysis.jsx): analysis page · Historical performance analysis surface · `src/pages/HistoryAnalysis.jsx`
- [AI Chatbot](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/pages/AIChatbot.jsx): analysis page · Conversational stock analysis surface · `src/pages/AIChatbot.jsx`
- [Candlestick](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/CandlestickChart.jsx): chart component · Price chart rendering · `src/components/CandlestickChart.jsx`
- [Quarterly Chart](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/QuarterlyChart.jsx): chart component · Longer-horizon financial visualization · `src/components/QuarterlyChart.jsx`
- [Data Window](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/DataWindow.jsx): summary panel · Structured metrics and summaries · `src/components/DataWindow.jsx`
- [Modal](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/Modal.jsx): ui overlay · Dialog and focus overlay · `src/components/Modal.jsx`
- [Source Link](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/components/SourceLink.jsx): provenance link · External reference or attribution link · `src/components/SourceLink.jsx`
- [API Client](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/services/apiClient.js): http layer · Shared outbound request helper · `src/services/apiClient.js`
- [Stock Service](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/services/stockService.js): market adapter · Domain API for stock and market data · `src/services/stockService.js`
- [Gemini Service](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/services/geminiService.js): ai adapter · Domain API for chatbot responses · `src/services/geminiService.js`
- [Formatters](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/utils/formatters.js): display utils · Number, date, and label formatting · `src/utils/formatters.js`
- [Constants](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/src/utils/constants.js): config utils · Shared application constants · `src/utils/constants.js`

### Delivery Artifacts

Static hosting files and legacy copies

- [Vite Build](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/vite.config.js): tooling config · Frontend build and dev configuration · `vite.config.js`
- [Tailwind Config](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/tailwind.config.js): styling config · Utility-first styling setup · `tailwind.config.js`
- [Netlify](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/netlify.toml): deploy config · Static hosting configuration · `netlify.toml`
- [Vercel](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/vercel.json): deploy config · Static hosting configuration · `vercel.json`
- [Legacy Static App](https://github.com/ishaanmukeshpatil-ui/indian-stock-analyzer/blob/HEAD/public/index.html): static copy · Older HTML/CSS/JS deployment copies · `public/index.html`

## Connections

- Entry → App: mounts · React entry mounts the application root
- App → Layout: wraps · Root composition uses the shared shell
- Layout → Header: includes · Shell renders the global header
- Layout → Sidebar: includes · Shell renders the main navigation
- Layout → Watchlist: contains · Shell surfaces the watchlist panel
- Layout → Current View: navigates · Shell can present the current market view
- Layout → History View: navigates · Shell can present the history analysis view
- Layout → AI Chatbot: navigates · Shell can present the chatbot view
- Current View → Stock Service: loads · Current view fetches market data
- History View → Stock Service: loads · History view fetches historical market data
- AI Chatbot → Gemini Service: queries · Chatbot requests AI-generated analysis
- Stock Service → API Client: uses · Market service delegates network calls
- Gemini Service → API Client: uses · AI service delegates network calls
- Current View → Candlestick: renders · Current view uses price charts
- History View → Quarterly Chart: renders · History view uses long-horizon charts
- Current View → Data Window: renders · Current view shows summarized metrics
- History View → Data Window: renders · History view shows summarized metrics
- AI Chatbot → Source Link: references · Chatbot may show provenance or external links
- Current View → Formatters: formats · View formatting is standardized
- History View → Formatters: formats · View formatting is standardized
- AI Chatbot → Constants: configures · Shared settings guide app behavior
- Vite Build → Entry: builds · Vite builds the React entry
- Tailwind Config → Layout: styles · Tailwind supports the UI shell and components
- Netlify → App: deploys · Static deployment target for the SPA
- Vercel → App: deploys · Static deployment target for the SPA
- Legacy Static App → App: mirrors · Legacy static copy mirrors the main app
