# jordan73737/stock-dashboard architecture

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

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

## Overview

Stock Dashboard is a full-stack stock-investment simulator. Users register or sign in, browse and search stocks, manage favourites, simulate trades against a mock balance, and review portfolio value history. React routes and Redux state coordinate the UI; an Express API handles authentication and portfolio operations, with PostgreSQL persistence and Finnhub quotes. Password recovery is a separate email-and-token capability. Some component and server code was only sampled partially, so uncertain integrations are omitted or marked unverified.

Main entry points: [`src/App.jsx`](https://github.com/jordan73737/stock-dashboard/blob/main/src/App.jsx) (Routes and shell), [`backend/server.js`](https://github.com/jordan73737/stock-dashboard/blob/main/backend/server.js) (Express API), [`src/slices/stocksSlice.js`](https://github.com/jordan73737/stock-dashboard/blob/main/src/slices/stocksSlice.js) (Stocks state), [`backend/routes/auth.js`](https://github.com/jordan73737/stock-dashboard/blob/main/backend/routes/auth.js) (Recovery routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_main["React bootstrap<br/>[main.jsx]"]
  node_app["Routes and shell<br/>[App.jsx]"]
  node_login["Sign in<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_recover["Password recovery"]
  node_reset["Password reset<br/>[ResetPassword.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_authstate["Auth state<br/>[authSlice.js]"]
  node_store["Redux store<br/>[store.js]"]
end

subgraph group_portfolio["Stocks and portfolio"]
  node_home["Popular stocks<br/>[Home.jsx]"]
  node_dashboard["Stock dashboard<br/>[Dashboard.jsx]"]
  node_stockstate["Stocks state<br/>[stocksSlice.js]"]
  node_profile["Portfolio profile<br/>[Profile.jsx]"]
  node_trade["Trade panel<br/>[TradeSidebar.jsx]"]
  node_history["Value history chart"]
end

subgraph group_backend["API and persistence"]
  node_api["Express API<br/>[server.js]"]
  node_passwordroutes["Recovery routes<br/>[auth.js]"]
  node_userdb["User DB helper<br/>[users.js]"]
end

subgraph group_integrations["External services"]
  node_postgres[("PostgreSQL")]
  node_finnhub["Finnhub market data"]
  node_sendgrid["SendGrid email"]
end

node_user(("Investor"))

node_user -->|"uses"| node_main
node_main -->|"provides state"| node_store
node_main -->|"renders"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_recover
node_app -->|"routes to"| node_reset
node_store -->|"uses reducer"| node_authstate
node_store -->|"uses reducer"| node_stockstate
node_login -->|"dispatches auth"| node_authstate
node_register -->|"dispatches auth"| node_authstate
node_navbar -->|"reads auth"| node_authstate
node_authstate -->|"calls auth API"| node_api
node_recover -.->|"requests reset"| node_passwordroutes
node_reset -.->|"submits password"| node_passwordroutes
node_home -->|"fetches stocks"| node_api
node_home -->|"dispatches favorites"| node_stockstate
node_home -->|"opens panel"| node_trade
node_dashboard -->|"dispatches favorites"| node_stockstate
node_dashboard -->|"searches symbols"| node_finnhub
node_stockstate -->|"reads favorites"| node_api
node_stockstate -->|"fetches quotes"| node_finnhub
node_profile -->|"reads portfolio"| node_api
node_profile -->|"opens panel"| node_trade
node_profile -->|"renders chart"| node_history
node_trade -->|"submits trades"| node_api
node_api -->|"mounts routes"| node_passwordroutes
node_passwordroutes -->|"looks up users"| node_userdb
node_api -->|"queries portfolio data"| node_postgres
node_userdb -->|"reads and updates"| node_postgres
node_api -->|"fetches quotes"| node_finnhub
node_passwordroutes -->|"sends reset email"| node_sendgrid

click node_main "https://github.com/jordan73737/stock-dashboard/blob/main/src/main.jsx"
click node_app "https://github.com/jordan73737/stock-dashboard/blob/main/src/App.jsx"
click node_login "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Login.jsx"
click node_register "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Register.jsx"
click node_recover "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/RecoverPassword.jsx"
click node_reset "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/ResetPassword.jsx"
click node_navbar "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Navbar.jsx"
click node_authstate "https://github.com/jordan73737/stock-dashboard/blob/main/src/slices/authSlice.js"
click node_store "https://github.com/jordan73737/stock-dashboard/blob/main/src/store.js"
click node_home "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Home.jsx"
click node_dashboard "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Dashboard.jsx"
click node_stockstate "https://github.com/jordan73737/stock-dashboard/blob/main/src/slices/stocksSlice.js"
click node_profile "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Profile.jsx"
click node_trade "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/TradeSidebar.jsx"
click node_history "https://github.com/jordan73737/stock-dashboard/blob/main/src/components/ValueHistoryChart.jsx"
click node_api "https://github.com/jordan73737/stock-dashboard/blob/main/backend/server.js"
click node_passwordroutes "https://github.com/jordan73737/stock-dashboard/blob/main/backend/routes/auth.js"
click node_userdb "https://github.com/jordan73737/stock-dashboard/blob/main/backend/db/users.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_main,node_app,node_login,node_register,node_recover,node_reset,node_navbar,node_authstate,node_store toneBlue
class node_home,node_dashboard,node_stockstate,node_profile,node_trade,node_history toneAmber
class node_api,node_passwordroutes,node_userdb toneMint
class node_postgres,node_finnhub,node_sendgrid toneRose
class node_user toneIndigo
```

## Components

### Web client

- [React bootstrap](https://github.com/jordan73737/stock-dashboard/blob/main/src/main.jsx): `src/main.jsx`
- [Routes and shell](https://github.com/jordan73737/stock-dashboard/blob/main/src/App.jsx): `src/App.jsx`
- [Sign in](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Login.jsx): `src/components/Login.jsx`
- [Registration](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Register.jsx): `src/components/Register.jsx`
- [Password recovery](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/RecoverPassword.jsx): `src/components/RecoverPassword.jsx`
- [Password reset](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/ResetPassword.jsx): `src/components/ResetPassword.jsx`
- [Navigation](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`
- [Auth state](https://github.com/jordan73737/stock-dashboard/blob/main/src/slices/authSlice.js): `src/slices/authSlice.js`
- [Redux store](https://github.com/jordan73737/stock-dashboard/blob/main/src/store.js): `src/store.js`

### Stocks and portfolio

- [Popular stocks](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Home.jsx): `src/components/Home.jsx`
- [Stock dashboard](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Dashboard.jsx): `src/components/Dashboard.jsx`
- [Stocks state](https://github.com/jordan73737/stock-dashboard/blob/main/src/slices/stocksSlice.js): `src/slices/stocksSlice.js`
- [Portfolio profile](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/Profile.jsx): `src/components/Profile.jsx`
- [Trade panel](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/TradeSidebar.jsx): `src/components/TradeSidebar.jsx`
- [Value history chart](https://github.com/jordan73737/stock-dashboard/blob/main/src/components/ValueHistoryChart.jsx): `src/components/ValueHistoryChart.jsx`

### API and persistence

- [Express API](https://github.com/jordan73737/stock-dashboard/blob/main/backend/server.js): `backend/server.js`
- [Recovery routes](https://github.com/jordan73737/stock-dashboard/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [User DB helper](https://github.com/jordan73737/stock-dashboard/blob/main/backend/db/users.js): `backend/db/users.js`

### External services

- **PostgreSQL**
- **Finnhub market data**
- **SendGrid email**

### Other components

- **Investor**

## Connections

- Investor → React bootstrap: uses (evidence: `README.md`)
- React bootstrap → Redux store: provides state (evidence: `src/main.jsx`)
- React bootstrap → Routes and shell: renders (evidence: `src/main.jsx`)
- Routes and shell → Navigation: renders (evidence: `src/App.jsx`)
- Routes and shell → Sign in: routes to (evidence: `src/App.jsx`)
- Routes and shell → Registration: routes to (evidence: `src/App.jsx`)
- Routes and shell → Popular stocks: routes to (evidence: `src/App.jsx`)
- Routes and shell → Stock dashboard: routes to (evidence: `src/App.jsx`)
- Routes and shell → Portfolio profile: routes to (evidence: `src/App.jsx`)
- Routes and shell → Password recovery: routes to (evidence: `src/App.jsx`)
- Routes and shell → Password reset: routes to (evidence: `src/App.jsx`)
- Redux store → Auth state: uses reducer (evidence: `src/store.js`)
- Redux store → Stocks state: uses reducer (evidence: `src/store.js`)
- Sign in → Auth state: dispatches auth (evidence: `src/components/Login.jsx`)
- Registration → Auth state: dispatches auth (evidence: `src/components/Register.jsx`)
- Navigation → Auth state: reads auth (evidence: `src/components/Navbar.jsx`)
- Auth state → Express API: calls auth API (evidence: `src/slices/authSlice.js`)
- Password recovery → Recovery routes: requests reset
- Password reset → Recovery routes: submits password
- Popular stocks → Express API: fetches stocks (evidence: `src/components/Home.jsx`)
- Popular stocks → Stocks state: dispatches favorites (evidence: `src/components/Home.jsx`)
- Popular stocks → Trade panel: opens panel (evidence: `src/components/Home.jsx`)
- Stock dashboard → Stocks state: dispatches favorites (evidence: `src/components/Dashboard.jsx`)
- Stock dashboard → Finnhub market data: searches symbols (evidence: `src/components/Dashboard.jsx`)
- Stocks state → Express API: reads favorites (evidence: `src/slices/stocksSlice.js`)
- Stocks state → Finnhub market data: fetches quotes (evidence: `src/slices/stocksSlice.js`)
- Portfolio profile → Express API: reads portfolio (evidence: `src/components/Profile.jsx`)
- Portfolio profile → Trade panel: opens panel (evidence: `src/components/Profile.jsx`)
- Portfolio profile → Value history chart: renders chart (evidence: `src/components/Profile.jsx`)
- Trade panel → Express API: submits trades (evidence: `src/components/TradeSidebar.jsx`)
- Express API → Recovery routes: mounts routes (evidence: `backend/server.js`)
- Recovery routes → User DB helper: looks up users (evidence: `backend/routes/auth.js`)
- Express API → PostgreSQL: queries portfolio data (evidence: `backend/server.js`)
- User DB helper → PostgreSQL: reads and updates (evidence: `backend/db/users.js`)
- Express API → Finnhub market data: fetches quotes (evidence: `backend/server.js`)
- Recovery routes → SendGrid email: sends reset email (evidence: `backend/routes/auth.js`)
