How ishaanmukeshpatil-ui/indian-stock-analyzer works
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: Layout.jsx Layout · CurrentSituation.jsx Current View · HistoryAnalysis.jsx History View · App.jsx App
Components 24
React App
Primary SPA source under src/
- Entry · Bootstraps the app
src/main.jsx - App · Top-level composition and page selection
src/App.jsx - Layout · Shared page frame and navigation wrapper
src/components/Layout.jsx - Header · Top bar and global actions
src/components/Header.jsx - Sidebar · Primary side navigation
src/components/Sidebar.jsx - Watchlist · Pinned stock list and quick switching
src/components/Watchlist.jsx - Current View · Live market situation surface
src/pages/CurrentSituation.jsx - History View · Historical performance analysis surface
src/pages/HistoryAnalysis.jsx - AI Chatbot · Conversational stock analysis surface
src/pages/AIChatbot.jsx - Candlestick · Price chart rendering
src/components/CandlestickChart.jsx - Quarterly Chart · Longer-horizon financial visualization
src/components/QuarterlyChart.jsx - Data Window · Structured metrics and summaries
src/components/DataWindow.jsx - Modal · Dialog and focus overlay
src/components/Modal.jsx - Source Link · External reference or attribution link
src/components/SourceLink.jsx - API Client · Shared outbound request helper
src/services/apiClient.js - Stock Service · Domain API for stock and market data
src/services/stockService.js - Gemini Service · Domain API for chatbot responses
src/services/geminiService.js - Formatters · Number, date, and label formatting
src/utils/formatters.js - Constants · Shared application constants
src/utils/constants.js
Delivery Artifacts
Static hosting files and legacy copies
- Vite Build · Frontend build and dev configuration
vite.config.js - Tailwind Config · Utility-first styling setup
tailwind.config.js - Netlify · Static hosting configuration
netlify.toml - Vercel · Static hosting configuration
vercel.json - Legacy Static App · Older HTML/CSS/JS deployment copies
public/index.html
Connections 26
- 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