# dobbyop09-web/stock-alert architecture

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

- Interactive diagram: https://gitdiagram.com/dobbyop09-web/stock-alert
- Repository: https://github.com/dobbyop09-web/stock-alert

## Overview

This is a Spring Boot stock-monitoring and alerting application with a lightweight GitHub Pages dashboard. Its principal workflow loads configured symbols, fetches market quotes, evaluates alert conditions, sends Telegram notifications, and publishes dashboard data for browsing and filtering. Separate capabilities cover market indicators, alert history, and portfolio snapshots. Edges use README statements or shown source references; some implementation details, including JSON generation and several frontend integrations, were not sampled, so their links are documented at subsystem level rather than inferred from filenames.

Main entry points: [`src/main/java/com/dobby/price_alert/service/StockProcessingService.java`](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/StockProcessingService.java) (Stock and alert evaluation), [`dashboard/js/main.js`](https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/main.js) (Dashboard startup), [`src/main/java/com/dobby/price_alert/service/CsvReaderService.java`](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/CsvReaderService.java) (Configured stock inputs), [`src/main/java/com/dobby/price_alert/service/MarketDataService.java`](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/MarketDataService.java) (Market data lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard UI"]
  node_dashboard_boot["Dashboard startup<br/>[main.js]"]
  node_dashboard_data["Data loading<br/>[data-loader.js]"]
  node_dashboard_state["Dashboard state<br/>[state.js]"]
  node_dashboard_filters["Search and filters<br/>[filters.js]"]
  node_dashboard_render["Dashboard rendering<br/>[render.js]"]
  node_historical_alert_ui["Alert history view"]
end

subgraph group_monitoring["Market Monitoring"]
  node_market_inputs["Configured stock inputs"]
  node_market_data["Market data lookup"]
  node_nse_client["NSE client<br/>[NSEClient.java]"]
  node_bse_client["BSE client<br/>[BseClient.java]"]
  node_kotak_data["Kotak quote mapping"]
  node_kotak_quotes["Kotak quote requests"]
  node_kotak_auth["Kotak authentication"]
  node_market_services["Market data services"]
end

subgraph group_alerts["Alerts and History"]
  node_stock_processing["Stock and alert evaluation"]
  node_alert_service["Alert cooldown checks"]
  node_telegram["Telegram notifications"]
  node_alert_history["Alert history"]
  node_r2_storage[("R2 object storage")]
end

subgraph group_indicators["Market Indicators"]
  node_indicator_services["Indicator data services"]
end

subgraph group_portfolio["Portfolio Snapshots"]
  node_portfolio_snapshots["Portfolio snapshots"]
end

node_visitor(("Dashboard visitor"))
node_pages(("GitHub Pages"))

node_visitor -->|"opens"| node_pages
node_pages -->|"serves UI"| node_dashboard_boot
node_dashboard_boot -->|"starts loading"| node_dashboard_data
node_dashboard_boot -->|"initializes"| node_dashboard_filters
node_dashboard_boot -->|"initializes"| node_historical_alert_ui
node_dashboard_data -.->|"populates"| node_dashboard_state
node_dashboard_filters -->|"filters"| node_dashboard_state
node_dashboard_render -->|"renders"| node_dashboard_state
node_dashboard_render -->|"applies filters"| node_dashboard_filters
node_dashboard_boot -.->|"loads data"| node_dashboard_render
node_market_inputs -->|"requests quotes"| node_market_data
node_market_inputs -->|"requests Kotak quotes"| node_kotak_data
node_market_data -->|"fetches NSE data"| node_nse_client
node_market_data -->|"fetches BSE data"| node_bse_client
node_kotak_data -->|"requests quotes"| node_kotak_quotes
node_kotak_auth -.->|"authenticates"| node_kotak_quotes
node_market_inputs -->|"processes stocks"| node_stock_processing
node_stock_processing -->|"checks cooldown"| node_alert_service
node_stock_processing -->|"sends notification"| node_telegram
node_stock_processing -->|"records alert"| node_alert_history
node_alert_history -->|"stores history"| node_r2_storage
node_market_services -->|"evaluates alerts"| node_stock_processing
node_stock_processing -.->|"publishes dashboard data"| node_dashboard_data
node_indicator_services -->|"fetches indicators"| node_nse_client
node_indicator_services -->|"uploads indicator data"| node_r2_storage
node_portfolio_snapshots -.->|"reads and writes"| node_r2_storage

click node_dashboard_boot "https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/main.js"
click node_dashboard_data "https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/data-loader.js"
click node_dashboard_state "https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/state.js"
click node_dashboard_filters "https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/filters.js"
click node_dashboard_render "https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/render.js"
click node_historical_alert_ui "https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/historical-alerts.js"
click node_market_inputs "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/CsvReaderService.java"
click node_market_data "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/MarketDataService.java"
click node_nse_client "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/client/NSEClient.java"
click node_bse_client "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/client/BseClient.java"
click node_kotak_data "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/kotak/KotakMarketDataService.java"
click node_kotak_quotes "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/kotak/KotakQuoteService.java"
click node_kotak_auth "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/kotak/KotakAuthService.java"
click node_stock_processing "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/StockProcessingService.java"
click node_alert_service "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/StockAlertService.java"
click node_telegram "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/TelegramService.java"
click node_alert_history "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/AlertHistoryService.java"
click node_r2_storage "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/R2UploadService.java"
click node_indicator_services "https://github.com/dobbyop09-web/stock-alert/tree/main/src/main/java/com/dobby/price_alert/service"
click node_portfolio_snapshots "https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/PortfolioSnapshotService.java"
click node_market_services "https://github.com/dobbyop09-web/stock-alert/tree/main/src/main/java/com/dobby/price_alert/service"

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_dashboard_boot,node_dashboard_data,node_dashboard_state,node_dashboard_filters,node_dashboard_render,node_historical_alert_ui toneBlue
class node_market_inputs,node_market_data,node_nse_client,node_bse_client,node_kotak_data,node_kotak_quotes,node_kotak_auth,node_market_services toneAmber
class node_stock_processing,node_alert_service,node_telegram,node_alert_history,node_r2_storage toneMint
class node_indicator_services toneRose
class node_portfolio_snapshots,node_visitor,node_pages toneIndigo
```

## Components

### Dashboard UI

- [Dashboard startup](https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/main.js): `dashboard/js/main.js`
- [Data loading](https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/data-loader.js): `dashboard/js/data-loader.js`
- [Dashboard state](https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/state.js): `dashboard/js/state.js`
- [Search and filters](https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/filters.js): `dashboard/js/filters.js`
- [Dashboard rendering](https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/render.js): `dashboard/js/render.js`
- [Alert history view](https://github.com/dobbyop09-web/stock-alert/blob/main/dashboard/js/historical-alerts.js): `dashboard/js/historical-alerts.js`

### Market Monitoring

- [Configured stock inputs](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/CsvReaderService.java): `src/main/java/com/dobby/price_alert/service/CsvReaderService.java`
- [Market data lookup](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/MarketDataService.java): `src/main/java/com/dobby/price_alert/service/MarketDataService.java`
- [NSE client](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/client/NSEClient.java): `src/main/java/com/dobby/price_alert/client/NSEClient.java`
- [BSE client](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/client/BseClient.java): `src/main/java/com/dobby/price_alert/client/BseClient.java`
- [Kotak quote mapping](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/kotak/KotakMarketDataService.java): `src/main/java/com/dobby/price_alert/service/kotak/KotakMarketDataService.java`
- [Kotak quote requests](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/kotak/KotakQuoteService.java): `src/main/java/com/dobby/price_alert/service/kotak/KotakQuoteService.java`
- [Kotak authentication](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/kotak/KotakAuthService.java): `src/main/java/com/dobby/price_alert/service/kotak/KotakAuthService.java`
- [Market data services](https://github.com/dobbyop09-web/stock-alert/tree/main/src/main/java/com/dobby/price_alert/service): `src/main/java/com/dobby/price_alert/service`

### Alerts and History

- [Stock and alert evaluation](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/StockProcessingService.java): `src/main/java/com/dobby/price_alert/service/StockProcessingService.java`
- [Alert cooldown checks](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/StockAlertService.java): `src/main/java/com/dobby/price_alert/service/StockAlertService.java`
- [Telegram notifications](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/TelegramService.java): `src/main/java/com/dobby/price_alert/service/TelegramService.java`
- [Alert history](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/AlertHistoryService.java): `src/main/java/com/dobby/price_alert/service/AlertHistoryService.java`
- [R2 object storage](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/R2UploadService.java): `src/main/java/com/dobby/price_alert/service/R2UploadService.java`

### Market Indicators

- [Indicator data services](https://github.com/dobbyop09-web/stock-alert/tree/main/src/main/java/com/dobby/price_alert/service): `src/main/java/com/dobby/price_alert/service`

### Portfolio Snapshots

- [Portfolio snapshots](https://github.com/dobbyop09-web/stock-alert/blob/main/src/main/java/com/dobby/price_alert/service/PortfolioSnapshotService.java): `src/main/java/com/dobby/price_alert/service/PortfolioSnapshotService.java`

### Other components

- **Dashboard visitor**
- **GitHub Pages**

## Connections

- Dashboard visitor → GitHub Pages: opens (evidence: `README.md`)
- GitHub Pages → Dashboard startup: serves UI (evidence: `README.md`)
- Dashboard startup → Data loading: starts loading (evidence: `dashboard/js/main.js`)
- Dashboard startup → Search and filters: initializes (evidence: `dashboard/js/main.js`)
- Dashboard startup → Alert history view: initializes (evidence: `dashboard/js/main.js`)
- Data loading → Dashboard state: populates (evidence: `dashboard/js/data-loader.js`)
- Search and filters → Dashboard state: filters (evidence: `dashboard/js/render.js`)
- Dashboard rendering → Dashboard state: renders (evidence: `dashboard/js/render.js`)
- Dashboard rendering → Search and filters: applies filters (evidence: `dashboard/js/render.js`)
- Dashboard startup → Dashboard rendering: loads data
- Configured stock inputs → Market data lookup: requests quotes (evidence: `src/main/java/com/dobby/price_alert/service/CsvReaderService.java`)
- Configured stock inputs → Kotak quote mapping: requests Kotak quotes (evidence: `src/main/java/com/dobby/price_alert/service/CsvReaderService.java`)
- Market data lookup → NSE client: fetches NSE data (evidence: `src/main/java/com/dobby/price_alert/service/MarketDataService.java`)
- Market data lookup → BSE client: fetches BSE data (evidence: `src/main/java/com/dobby/price_alert/service/MarketDataService.java`)
- Kotak quote mapping → Kotak quote requests: requests quotes (evidence: `src/main/java/com/dobby/price_alert/service/kotak/KotakMarketDataService.java`)
- Kotak authentication → Kotak quote requests: authenticates
- Configured stock inputs → Stock and alert evaluation: processes stocks (evidence: `src/main/java/com/dobby/price_alert/service/CsvReaderService.java`)
- Stock and alert evaluation → Alert cooldown checks: checks cooldown (evidence: `src/main/java/com/dobby/price_alert/service/StockProcessingService.java`)
- Stock and alert evaluation → Telegram notifications: sends notification (evidence: `src/main/java/com/dobby/price_alert/service/StockProcessingService.java`)
- Stock and alert evaluation → Alert history: records alert (evidence: `src/main/java/com/dobby/price_alert/service/StockProcessingService.java`)
- Alert history → R2 object storage: stores history (evidence: `src/main/java/com/dobby/price_alert/service/AlertHistoryService.java`)
- Market data services → Stock and alert evaluation: evaluates alerts (evidence: `README.md`)
- Stock and alert evaluation → Data loading: publishes dashboard data (evidence: `README.md`)
- Indicator data services → NSE client: fetches indicators (evidence: `src/main/java/com/dobby/price_alert/service/DerivativesService.java`)
- Indicator data services → R2 object storage: uploads indicator data (evidence: `src/main/java/com/dobby/price_alert/service/DerivativesService.java`)
- Portfolio snapshots → R2 object storage: reads and writes (evidence: `src/main/java/com/dobby/price_alert/service/PortfolioSnapshotService.java`)
