# sathwikarevoori/stock-market-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/sathwikarevoori/stock-market-dashboard
- Repository: https://github.com/sathwikarevoori/stock-market-dashboard

## Overview

This is a stock and portfolio tracking application with a React client and an Express/MongoDB server. The intended user workflow spans account access, stock lookup, transaction entry, portfolio valuation and analytics, and report download. The sampled Dashboard implements several of these interactions, but it is not among the routes registered in the sampled App; other page and route implementations were not provided. The graph therefore shows only supported wiring and keeps uncertain report and watchlist connections out.

Main entry points: [`client/src/pages/Dashboard.js`](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Dashboard.js) (Dashboard), [`server/server.js`](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/server.js) (API server), [`client/src/App.js`](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/App.js) (React app), [`client/src/components/ProtectedRoutes.js`](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/ProtectedRoutes.js) (Protected routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["React app<br/>[App.js]"]
  node_home["Home page<br/>[Home.js]"]
  node_dashboard["Dashboard<br/>[Dashboard.js]"]
end

subgraph group_identity["Identity"]
  node_authcontext["Auth context<br/>[AuthContext.js]"]
  node_protected["Protected routes<br/>[ProtectedRoutes.js]"]
  node_authpages["Login and register<br/>[Login.js]"]
  node_authroute["Auth API<br/>[auth.js]"]
  node_user_model[("User records<br/>[User.js]")]
end

subgraph group_portfolio["Portfolio"]
  node_portfolioentry["Transaction entry<br/>[AddTransaction.js]"]
  node_portfolioview["Portfolio view"]
  node_analytics["Portfolio analytics"]
  node_reports["Reports<br/>[Reports.js]"]
  node_portfolioroute["Portfolio API<br/>[portfolio.js]"]
  node_portfolio_service["Portfolio calculations"]
  node_pdfservice["PDF generation<br/>[pdfService.js]"]
  node_portfolio_model[("Portfolio records<br/>[Portfolio.js]")]
end

subgraph group_market["Market data"]
  node_stocksearch["Stock search<br/>[StockSearch.js]"]
  node_stockchart["Stock charts<br/>[StockPriceChart.js]"]
  node_stockpages["Stock pages<br/>[Stocks.js]"]
  node_liveticker["Live ticker<br/>[LiveStockTicker.js]"]
  node_stockroute["Stocks API<br/>[stocks.js]"]
  node_watchlistroute["Watchlist API<br/>[watchlist.js]"]
  node_stock_model[("Stock records<br/>[Stock.js]")]
end

node_user(("Investor"))
node_server["API server<br/>[server.js]"]
node_mongodb[("MongoDB")]
node_finnhub(("Finnhub"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_authcontext
node_app -->|"routes to"| node_home
node_app -->|"guards pages"| node_protected
node_protected -->|"checks user"| node_authcontext
node_app -->|"routes to"| node_authpages
node_dashboard -->|"renders"| node_stocksearch
node_stocksearch -->|"returns symbol"| node_dashboard
node_dashboard -->|"renders"| node_stockchart
node_dashboard -->|"requests summary and report"| node_portfolioroute
node_dashboard -->|"renders"| node_portfolioentry
node_dashboard -->|"renders"| node_portfolioview
node_dashboard -->|"renders"| node_analytics
node_server -->|"mounts API"| node_authroute
node_server -->|"mounts API"| node_stockroute
node_server -->|"mounts API"| node_watchlistroute
node_server -->|"mounts API"| node_portfolioroute
node_authroute -->|"reads and writes"| node_user_model
node_server -->|"connects"| node_mongodb
node_portfolio_service -->|"requests prices"| node_stockroute
node_server -.->|"subscribes to quotes"| node_finnhub

click node_app "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/App.js"
click node_home "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Home.js"
click node_dashboard "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Dashboard.js"
click node_stocksearch "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/StockSearch.js"
click node_stockchart "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/StockPriceChart.js"
click node_stockpages "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Stocks.js"
click node_liveticker "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/LiveStockTicker.js"
click node_authcontext "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/context/AuthContext.js"
click node_protected "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/ProtectedRoutes.js"
click node_authpages "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Login.js"
click node_portfolioentry "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/AddTransaction.js"
click node_portfolioview "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/PortfolioSummary.js"
click node_analytics "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/PortfolioAnalytics.js"
click node_reports "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Reports.js"
click node_server "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/server.js"
click node_authroute "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/routes/auth.js"
click node_portfolioroute "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/routes/portfolio.js"
click node_stockroute "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/routes/stocks.js"
click node_watchlistroute "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/routes/watchlist.js"
click node_portfolio_service "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/services/portfolioService.js"
click node_pdfservice "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/services/pdfService.js"
click node_user_model "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/models/User.js"
click node_portfolio_model "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/models/Portfolio.js"
click node_stock_model "https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/models/Stock.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_app,node_home,node_dashboard toneBlue
class node_authcontext,node_protected,node_authpages,node_authroute,node_user_model,node_mongodb toneAmber
class node_portfolioentry,node_portfolioview,node_analytics,node_reports,node_portfolioroute,node_portfolio_service,node_pdfservice,node_portfolio_model,node_server toneMint
class node_stocksearch,node_stockchart,node_stockpages,node_liveticker,node_stockroute,node_watchlistroute,node_stock_model toneRose
class node_user,node_finnhub toneIndigo
```

## Components

### Client experience

- [React app](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/App.js): `client/src/App.js`
- [Home page](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Home.js): `client/src/pages/Home.js`
- [Dashboard](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Dashboard.js): `client/src/pages/Dashboard.js`

### Identity

- [Auth context](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/context/AuthContext.js): `client/src/context/AuthContext.js`
- [Protected routes](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/ProtectedRoutes.js): `client/src/components/ProtectedRoutes.js`
- [Login and register](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Login.js): `client/src/pages/Login.js`
- [Auth API](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/routes/auth.js): `server/routes/auth.js`
- [User records](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/models/User.js): `server/models/User.js`

### Portfolio

- [Transaction entry](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/AddTransaction.js): `client/src/pages/AddTransaction.js`
- [Portfolio view](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/PortfolioSummary.js): `client/src/pages/PortfolioSummary.js`
- [Portfolio analytics](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/PortfolioAnalytics.js): `client/src/pages/PortfolioAnalytics.js`
- [Reports](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Reports.js): `client/src/pages/Reports.js`
- [Portfolio API](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/routes/portfolio.js): `server/routes/portfolio.js`
- [Portfolio calculations](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/services/portfolioService.js): `server/services/portfolioService.js`
- [PDF generation](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/services/pdfService.js): `server/services/pdfService.js`
- [Portfolio records](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/models/Portfolio.js): `server/models/Portfolio.js`

### Market data

- [Stock search](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/StockSearch.js): `client/src/components/StockSearch.js`
- [Stock charts](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/StockPriceChart.js): `client/src/components/StockPriceChart.js`
- [Stock pages](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/pages/Stocks.js): `client/src/pages/Stocks.js`
- [Live ticker](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/client/src/components/LiveStockTicker.js): `client/src/components/LiveStockTicker.js`
- [Stocks API](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/routes/stocks.js): `server/routes/stocks.js`
- [Watchlist API](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/routes/watchlist.js): `server/routes/watchlist.js`
- [Stock records](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/models/Stock.js): `server/models/Stock.js`

### Other components

- **Investor**
- [API server](https://github.com/sathwikarevoori/stock-market-dashboard/blob/master/server/server.js): `server/server.js`
- **MongoDB**
- **Finnhub**

## Connections

- Investor → React app: uses
- React app → Auth context: provides auth
- React app → Home page: routes to
- React app → Protected routes: guards pages
- Protected routes → Auth context: checks user
- React app → Login and register: routes to
- Dashboard → Stock search: renders
- Stock search → Dashboard: returns symbol
- Dashboard → Stock charts: renders
- Dashboard → Portfolio API: requests summary and report
- Dashboard → Transaction entry: renders
- Dashboard → Portfolio view: renders
- Dashboard → Portfolio analytics: renders
- API server → Auth API: mounts API
- API server → Stocks API: mounts API
- API server → Watchlist API: mounts API
- API server → Portfolio API: mounts API
- Auth API → User records: reads and writes
- API server → MongoDB: connects
- Portfolio calculations → Stocks API: requests prices
- API server → Finnhub: subscribes to quotes
