# aaayu-07/stocksense architecture

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

- Interactive diagram: https://gitdiagram.com/aaayu-07/stocksense
- Repository: https://github.com/aaayu-07/stocksense

## Overview

StockSense’s main workflow lets an analyst choose a company and date range, then view price trends, summaries, comparisons, and market movers. The dashboard calls a frontend API client; backend routes delegate stock queries to an analytics service that fetches and processes Yahoo Finance data and caches records in the database. The README also advertises authentication, watchlists, recent activity, and caching, but the sampled implementation only substantiates the stock-data and cache workflow; those other capabilities are represented cautiously. Some frontend-to-backend wiring is documented rather than shown in the sampled source.

Main entry points: [`frontend/src/App.jsx`](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/App.jsx) (Route shell), [`backend/services/stock_service.py`](https://github.com/aaayu-07/stocksense/blob/main/backend/services/stock_service.py) (Stock analytics), [`frontend/src/components`](https://github.com/aaayu-07/stocksense/tree/main/frontend/src/components) (Dashboard views), [`backend/routes/stock_routes.py`](https://github.com/aaayu-07/stocksense/blob/main/backend/routes/stock_routes.py) (Stock endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["Route shell<br/>[App.jsx]"]
  node_home["Landing page<br/>[HomePage.jsx]"]
  node_landing_ui["Landing components"]
  node_content_pages["Content pages<br/>[ContactPage.jsx]"]
  node_content_shell["Content shell"]
  node_dashboard["Analytics dashboard<br/>[DashboardPage.jsx]"]
  node_dashboard_ui["Dashboard views"]
  node_chart["Interactive chart<br/>[StockChart.jsx]"]
  node_brand["Brand mark<br/>[BrandMark.jsx]"]
  node_theme_toggle["Theme toggle<br/>[ThemeToggle.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["Stock API"]
  node_api_routes["Stock endpoints<br/>[stock_routes.py]"]
  node_app_server["FastAPI application<br/>[main.py]"]
  node_auth["JWT authentication"]
end

subgraph group_analytics["Data and analytics"]
  node_stock_service["Stock analytics<br/>[stock_service.py]"]
end

subgraph group_state["Persistence and preferences"]
  node_theme["Theme state<br/>[ThemeContext.jsx]"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_stock_records["Stock records<br/>[models.py]"]
  node_stock_db[("SQLite store<br/>[stocksense.db]")]
  node_watchlist["Watchlist and activity"]
end

node_analyst(("Analyst"))
node_yahoo["Yahoo Finance"]

node_analyst -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_content_pages
node_home -->|"renders"| node_landing_ui
node_content_pages -->|"renders"| node_content_shell
node_content_shell -->|"uses shared navigation"| node_landing_ui
node_dashboard -->|"renders"| node_dashboard_ui
node_dashboard_ui -.->|"renders"| node_chart
node_dashboard_ui -.->|"uses"| node_brand
node_dashboard_ui -.->|"uses"| node_theme_toggle
node_theme_toggle -->|"reads and toggles"| node_theme
node_app -->|"provides state"| node_theme
node_dashboard -->|"requests stock data"| node_api_client
node_api_client -.->|"calls endpoints"| node_api_routes
node_app_server -->|"registers routes"| node_api_routes
node_api_routes -->|"delegates queries"| node_stock_service
node_api_routes -->|"injects session"| node_db_session
node_stock_service -->|"downloads prices"| node_yahoo
node_stock_service -->|"reads and writes"| node_stock_records
node_stock_records -->|"uses ORM base"| node_db_session
node_db_session -->|"connects to"| node_stock_db
node_stock_service -.->|"authentication capability"| node_auth
node_stock_service -.->|"tracking capability"| node_watchlist

click node_app "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/pages/HomePage.jsx"
click node_landing_ui "https://github.com/aaayu-07/stocksense/tree/main/frontend/src/components/landing"
click node_content_pages "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/pages/ContactPage.jsx"
click node_content_shell "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/components/ContentPageShell.jsx"
click node_dashboard "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_dashboard_ui "https://github.com/aaayu-07/stocksense/tree/main/frontend/src/components"
click node_chart "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/components/StockChart.jsx"
click node_brand "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/components/BrandMark.jsx"
click node_theme_toggle "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/components/ThemeToggle.jsx"
click node_theme "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/context/ThemeContext.jsx"
click node_api_client "https://github.com/aaayu-07/stocksense/blob/main/frontend/src/services/api.js"
click node_api_routes "https://github.com/aaayu-07/stocksense/blob/main/backend/routes/stock_routes.py"
click node_app_server "https://github.com/aaayu-07/stocksense/blob/main/backend/main.py"
click node_stock_service "https://github.com/aaayu-07/stocksense/blob/main/backend/services/stock_service.py"
click node_db_session "https://github.com/aaayu-07/stocksense/blob/main/backend/database.py"
click node_stock_records "https://github.com/aaayu-07/stocksense/blob/main/backend/models.py"
click node_stock_db "https://github.com/aaayu-07/stocksense/blob/main/backend/data/stocksense.db"
click node_auth "https://github.com/aaayu-07/stocksense/tree/main/backend/routes"
click node_watchlist "https://github.com/aaayu-07/stocksense/tree/main/backend"

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_landing_ui,node_content_pages,node_content_shell,node_dashboard,node_dashboard_ui,node_chart,node_brand,node_theme_toggle,node_api_client toneBlue
class node_api_routes,node_app_server,node_auth toneAmber
class node_stock_service toneMint
class node_theme,node_db_session,node_stock_records,node_stock_db,node_watchlist toneRose
class node_analyst,node_yahoo toneIndigo
```

## Components

### Frontend experience

- [Route shell](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Landing page](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Landing components](https://github.com/aaayu-07/stocksense/tree/main/frontend/src/components/landing): `frontend/src/components/landing`
- [Content pages](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/pages/ContactPage.jsx): `frontend/src/pages/ContactPage.jsx`
- [Content shell](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/components/ContentPageShell.jsx): `frontend/src/components/ContentPageShell.jsx`
- [Analytics dashboard](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Dashboard views](https://github.com/aaayu-07/stocksense/tree/main/frontend/src/components): `frontend/src/components`
- [Interactive chart](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/components/StockChart.jsx): `frontend/src/components/StockChart.jsx`
- [Brand mark](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/components/BrandMark.jsx): `frontend/src/components/BrandMark.jsx`
- [Theme toggle](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/components/ThemeToggle.jsx): `frontend/src/components/ThemeToggle.jsx`
- [API client](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Stock API

- [Stock endpoints](https://github.com/aaayu-07/stocksense/blob/main/backend/routes/stock_routes.py): `backend/routes/stock_routes.py`
- [FastAPI application](https://github.com/aaayu-07/stocksense/blob/main/backend/main.py): `backend/main.py`
- [JWT authentication](https://github.com/aaayu-07/stocksense/tree/main/backend/routes): `backend/routes`

### Data and analytics

- [Stock analytics](https://github.com/aaayu-07/stocksense/blob/main/backend/services/stock_service.py): `backend/services/stock_service.py`

### Persistence and preferences

- [Theme state](https://github.com/aaayu-07/stocksense/blob/main/frontend/src/context/ThemeContext.jsx): `frontend/src/context/ThemeContext.jsx`
- [Database sessions](https://github.com/aaayu-07/stocksense/blob/main/backend/database.py): `backend/database.py`
- [Stock records](https://github.com/aaayu-07/stocksense/blob/main/backend/models.py): `backend/models.py`
- [SQLite store](https://github.com/aaayu-07/stocksense/blob/main/backend/data/stocksense.db): `backend/data/stocksense.db`
- [Watchlist and activity](https://github.com/aaayu-07/stocksense/tree/main/backend): `backend`

### Other components

- **Analyst**
- **Yahoo Finance**

## Connections

- Analyst → Route shell: uses (evidence: `README.md`)
- Route shell → Landing page: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Analytics dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Content pages: routes to (evidence: `frontend/src/App.jsx`)
- Landing page → Landing components: renders (evidence: `frontend/src/pages/HomePage.jsx`)
- Content pages → Content shell: renders (evidence: `frontend/src/pages/ContactPage.jsx`)
- Content shell → Landing components: uses shared navigation (evidence: `frontend/src/components/ContentPageShell.jsx`)
- Analytics dashboard → Dashboard views: renders (evidence: `frontend/src/pages/DashboardPage.jsx`)
- Dashboard views → Interactive chart: renders
- Dashboard views → Brand mark: uses (evidence: `frontend/src/components/dashboard/DashboardNavbar.jsx`)
- Dashboard views → Theme toggle: uses (evidence: `frontend/src/components/dashboard/DashboardNavbar.jsx`)
- Theme toggle → Theme state: reads and toggles (evidence: `frontend/src/components/ThemeToggle.jsx`)
- Route shell → Theme state: provides state (evidence: `frontend/src/main.jsx`)
- Analytics dashboard → API client: requests stock data (evidence: `frontend/src/pages/DashboardPage.jsx`)
- API client → Stock endpoints: calls endpoints (evidence: `README.md`)
- FastAPI application → Stock endpoints: registers routes (evidence: `backend/main.py`)
- Stock endpoints → Stock analytics: delegates queries (evidence: `backend/routes/stock_routes.py`)
- Stock endpoints → Database sessions: injects session (evidence: `backend/routes/stock_routes.py`)
- Stock analytics → Yahoo Finance: downloads prices (evidence: `backend/services/stock_service.py`)
- Stock analytics → Stock records: reads and writes (evidence: `backend/services/stock_service.py`)
- Stock records → Database sessions: uses ORM base (evidence: `backend/models.py`)
- Database sessions → SQLite store: connects to (evidence: `backend/database.py`)
- Stock analytics → JWT authentication: authentication capability (evidence: `README.md`)
- Stock analytics → Watchlist and activity: tracking capability (evidence: `README.md`)
