# shubhankar-jana/priceoracle-app architecture

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

- Interactive diagram: https://gitdiagram.com/shubhankar-jana/priceoracle-app
- Repository: https://github.com/shubhankar-jana/priceoracle-app

## Overview

PriceOracle provides multi-asset price predictions and market monitoring: users browse prices and asset history, view forecasts and analytics, and manage accounts, watchlists, and alerts. The React client routes requests to an Express API; backend routes and scheduled jobs use MongoDB, market-price sources, and a Python ML service. The ML side serves predictions and supports preprocessing and model retraining. The graph preserves the documented frontend, backend, and ML capabilities; some page and job internals were not sampled, so their links are limited to documented or indexed relationships.

Main entry points: [`client/src/App.jsx`](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/App.jsx) (React application), [`server/app.js`](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/app.js) (Express API), [`server/models/Asset.js`](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/models/Asset.js) (Asset records), [`server/services/mlBridge.js`](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/mlBridge.js) (ML service bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User application"]
  node_react_app["React application<br/>[App.jsx]"]
  node_auth_context["Authentication state<br/>[AuthContext.jsx]"]
  node_socket_context["Live connection<br/>[SocketContext.jsx]"]
  node_dashboard["Market dashboard<br/>[Dashboard.jsx]"]
  node_asset_detail["Asset details<br/>[AssetDetail.jsx]"]
  node_predictions_page["Predictions view<br/>[Predictions.jsx]"]
  node_analytics["Analytics<br/>[Analytics.jsx]"]
  node_watchlist["Watchlist<br/>[Watchlist.jsx]"]
  node_account_pages["Account pages"]
  node_content_pages["Editorial pages"]
  node_http_client["HTTP client<br/>[axios.js]"]
end

subgraph group_api["API and accounts"]
  node_express_app["Express API<br/>[app.js]"]
  node_auth_routes["Account endpoints<br/>[auth.js]"]
  node_asset_routes["Asset endpoints<br/>[assets.js]"]
  node_prediction_routes["Prediction endpoints<br/>[predictions.js]"]
  node_user_routes["User endpoints<br/>[user.js]"]
  node_alert_routes["Alert endpoints<br/>[alerts.js]"]
  node_auth_middleware["Token authentication<br/>[auth.js]"]
  node_user_model[("User records<br/>[User.js]")]
end

subgraph group_market["Market data and jobs"]
  node_asset_model[("Asset records<br/>[Asset.js]")]
  node_prediction_model[("Forecast records<br/>[Prediction.js]")]
  node_price_service["Price service<br/>[priceService.js]"]
  node_yahoo_service["Yahoo history fetcher"]
  node_scheduled_jobs["Scheduled jobs"]
  node_alert_job["Alert checker<br/>[alertChecker.js]"]
  node_notification["Notifications"]
  node_mongo[("MongoDB")]
end

subgraph group_ml["Prediction pipeline"]
  node_ml_bridge["ML service bridge<br/>[mlBridge.js]"]
  node_ml_api["Python prediction API<br/>[api_server.py]"]
  node_predict["Forecast inference<br/>[predict.py]"]
  node_preprocessing["Feature preparation<br/>[preprocessing.py]"]
  node_retraining["Model retraining"]
end

node_user(("User"))
node_yahoo["Yahoo Finance"]

node_user -->|"browses"| node_react_app
node_react_app -->|"provides state"| node_auth_context
node_react_app -->|"provides connection"| node_socket_context
node_react_app -->|"routes to"| node_dashboard
node_react_app -->|"routes to"| node_asset_detail
node_react_app -->|"routes to"| node_predictions_page
node_react_app -->|"routes to"| node_analytics
node_react_app -->|"routes to"| node_watchlist
node_react_app -->|"routes to"| node_account_pages
node_react_app -->|"routes to"| node_content_pages
node_dashboard -.->|"requests data"| node_http_client
node_asset_detail -.->|"requests data"| node_http_client
node_predictions_page -.->|"requests forecasts"| node_http_client
node_http_client -.->|"sends API requests"| node_express_app
node_express_app -->|"mounts"| node_auth_routes
node_express_app -->|"mounts"| node_asset_routes
node_express_app -->|"mounts"| node_prediction_routes
node_express_app -->|"mounts"| node_alert_routes
node_express_app -->|"mounts"| node_user_routes
node_auth_routes -->|"reads and writes"| node_user_model
node_auth_routes -->|"uses"| node_auth_middleware
node_auth_middleware -->|"loads user"| node_user_model
node_asset_routes -->|"reads and writes"| node_asset_model
node_asset_routes -->|"reads forecasts"| node_prediction_model
node_asset_routes -->|"requests predictions"| node_ml_bridge
node_prediction_routes -->|"reads and writes"| node_prediction_model
node_prediction_routes -->|"reads assets"| node_asset_model
node_prediction_routes -->|"requests forecasts"| node_ml_bridge
node_user_routes -->|"reads and updates"| node_user_model
node_user_routes -->|"reads assets"| node_asset_model
node_alert_routes -.->|"uses"| node_auth_middleware
node_scheduled_jobs -->|"runs price updates"| node_price_service
node_scheduled_jobs -->|"starts checker"| node_alert_job
node_alert_job -->|"reads market data"| node_asset_model
node_alert_job -->|"sends notifications"| node_notification
node_price_service -->|"updates prices"| node_asset_model
node_price_service -->|"requests market data"| node_ml_bridge
node_scheduled_jobs -->|"stores forecasts"| node_prediction_model
node_scheduled_jobs -->|"runs forecasts"| node_ml_bridge
node_yahoo_service -->|"fetches history"| node_yahoo
node_ml_bridge -->|"calls prediction API"| node_ml_api
node_ml_api -->|"uses inference"| node_predict
node_ml_api -->|"runs retraining"| node_retraining
node_predict -->|"prepares features"| node_preprocessing
node_retraining -->|"prepares training data"| node_preprocessing
node_asset_model -.->|"persists records"| node_mongo
node_prediction_model -.->|"persists records"| node_mongo
node_user_model -.->|"persists records"| node_mongo

click node_react_app "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/App.jsx"
click node_auth_context "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/context/AuthContext.jsx"
click node_socket_context "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/context/SocketContext.jsx"
click node_dashboard "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/Dashboard.jsx"
click node_asset_detail "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/AssetDetail.jsx"
click node_predictions_page "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/Predictions.jsx"
click node_analytics "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/Analytics.jsx"
click node_watchlist "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/Watchlist.jsx"
click node_account_pages "https://github.com/shubhankar-jana/priceoracle-app/tree/main/client/src/pages"
click node_content_pages "https://github.com/shubhankar-jana/priceoracle-app/tree/main/client/src/pages"
click node_http_client "https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/api/axios.js"
click node_express_app "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/app.js"
click node_auth_routes "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/auth.js"
click node_asset_routes "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/assets.js"
click node_prediction_routes "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/predictions.js"
click node_user_routes "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/user.js"
click node_alert_routes "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/alerts.js"
click node_auth_middleware "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/middleware/auth.js"
click node_user_model "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/models/User.js"
click node_asset_model "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/models/Asset.js"
click node_prediction_model "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/models/Prediction.js"
click node_price_service "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/priceService.js"
click node_yahoo_service "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/yahooFinanceService.js"
click node_scheduled_jobs "https://github.com/shubhankar-jana/priceoracle-app/tree/main/server/jobs"
click node_alert_job "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/jobs/alertChecker.js"
click node_notification "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/notificationService.js"
click node_ml_bridge "https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/mlBridge.js"
click node_ml_api "https://github.com/shubhankar-jana/priceoracle-app/blob/main/ml/api_server.py"
click node_predict "https://github.com/shubhankar-jana/priceoracle-app/blob/main/ml/predict.py"
click node_preprocessing "https://github.com/shubhankar-jana/priceoracle-app/blob/main/ml/preprocessing.py"
click node_retraining "https://github.com/shubhankar-jana/priceoracle-app/blob/main/ml/retrain_pipeline.py"

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_react_app,node_auth_context,node_socket_context,node_dashboard,node_asset_detail,node_predictions_page,node_analytics,node_watchlist,node_account_pages,node_content_pages,node_http_client,node_user toneBlue
class node_express_app,node_auth_routes,node_asset_routes,node_prediction_routes,node_user_routes,node_alert_routes,node_auth_middleware,node_user_model toneAmber
class node_asset_model,node_prediction_model,node_price_service,node_yahoo_service,node_scheduled_jobs,node_alert_job,node_notification,node_mongo toneMint
class node_ml_bridge,node_ml_api,node_predict,node_preprocessing,node_retraining toneRose
class node_yahoo toneIndigo
```

## Components

### User application

- [React application](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Authentication state](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Live connection](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/context/SocketContext.jsx): `client/src/context/SocketContext.jsx`
- [Market dashboard](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Asset details](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/AssetDetail.jsx): `client/src/pages/AssetDetail.jsx`
- [Predictions view](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/Predictions.jsx): `client/src/pages/Predictions.jsx`
- [Analytics](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/Analytics.jsx): `client/src/pages/Analytics.jsx`
- [Watchlist](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/pages/Watchlist.jsx): `client/src/pages/Watchlist.jsx`
- [Account pages](https://github.com/shubhankar-jana/priceoracle-app/tree/main/client/src/pages): `client/src/pages`
- [Editorial pages](https://github.com/shubhankar-jana/priceoracle-app/tree/main/client/src/pages): `client/src/pages`
- [HTTP client](https://github.com/shubhankar-jana/priceoracle-app/blob/main/client/src/api/axios.js): `client/src/api/axios.js`

### API and accounts

- [Express API](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/app.js): `server/app.js`
- [Account endpoints](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [Asset endpoints](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/assets.js): `server/routes/assets.js`
- [Prediction endpoints](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/predictions.js): `server/routes/predictions.js`
- [User endpoints](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/user.js): `server/routes/user.js`
- [Alert endpoints](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/routes/alerts.js): `server/routes/alerts.js`
- [Token authentication](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/middleware/auth.js): `server/middleware/auth.js`
- [User records](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/models/User.js): `server/models/User.js`

### Market data and jobs

- [Asset records](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/models/Asset.js): `server/models/Asset.js`
- [Forecast records](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/models/Prediction.js): `server/models/Prediction.js`
- [Price service](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/priceService.js): `server/services/priceService.js`
- [Yahoo history fetcher](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/yahooFinanceService.js): `server/services/yahooFinanceService.js`
- [Scheduled jobs](https://github.com/shubhankar-jana/priceoracle-app/tree/main/server/jobs): `server/jobs`
- [Alert checker](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/jobs/alertChecker.js): `server/jobs/alertChecker.js`
- [Notifications](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/notificationService.js): `server/services/notificationService.js`
- **MongoDB**

### Prediction pipeline

- [ML service bridge](https://github.com/shubhankar-jana/priceoracle-app/blob/main/server/services/mlBridge.js): `server/services/mlBridge.js`
- [Python prediction API](https://github.com/shubhankar-jana/priceoracle-app/blob/main/ml/api_server.py): `ml/api_server.py`
- [Forecast inference](https://github.com/shubhankar-jana/priceoracle-app/blob/main/ml/predict.py): `ml/predict.py`
- [Feature preparation](https://github.com/shubhankar-jana/priceoracle-app/blob/main/ml/preprocessing.py): `ml/preprocessing.py`
- [Model retraining](https://github.com/shubhankar-jana/priceoracle-app/blob/main/ml/retrain_pipeline.py): `ml/retrain_pipeline.py`

### Other components

- **User**
- **Yahoo Finance**

## Connections

- User → React application: browses (evidence: `client/src/App.jsx`)
- React application → Authentication state: provides state (evidence: `client/src/App.jsx`)
- React application → Live connection: provides connection (evidence: `client/src/App.jsx`)
- React application → Market dashboard: routes to (evidence: `client/src/App.jsx`)
- React application → Asset details: routes to (evidence: `client/src/App.jsx`)
- React application → Predictions view: routes to (evidence: `client/src/App.jsx`)
- React application → Analytics: routes to (evidence: `client/src/App.jsx`)
- React application → Watchlist: routes to (evidence: `client/src/App.jsx`)
- React application → Account pages: routes to (evidence: `client/src/App.jsx`)
- React application → Editorial pages: routes to (evidence: `client/src/App.jsx`)
- Market dashboard → HTTP client: requests data
- Asset details → HTTP client: requests data
- Predictions view → HTTP client: requests forecasts
- HTTP client → Express API: sends API requests
- Express API → Account endpoints: mounts (evidence: `server/app.js`)
- Express API → Asset endpoints: mounts (evidence: `server/app.js`)
- Express API → Prediction endpoints: mounts (evidence: `server/app.js`)
- Express API → Alert endpoints: mounts (evidence: `server/app.js`)
- Express API → User endpoints: mounts (evidence: `server/app.js`)
- Account endpoints → User records: reads and writes (evidence: `server/routes/auth.js`)
- Account endpoints → Token authentication: uses (evidence: `server/routes/auth.js`)
- Token authentication → User records: loads user (evidence: `server/middleware/auth.js`)
- Asset endpoints → Asset records: reads and writes (evidence: `server/routes/assets.js`)
- Asset endpoints → Forecast records: reads forecasts (evidence: `server/routes/assets.js`)
- Asset endpoints → ML service bridge: requests predictions (evidence: `server/routes/assets.js`)
- Prediction endpoints → Forecast records: reads and writes (evidence: `server/routes/predictions.js`)
- Prediction endpoints → Asset records: reads assets (evidence: `server/routes/predictions.js`)
- Prediction endpoints → ML service bridge: requests forecasts (evidence: `server/routes/predictions.js`)
- User endpoints → User records: reads and updates (evidence: `server/routes/user.js`)
- User endpoints → Asset records: reads assets (evidence: `server/routes/user.js`)
- Alert endpoints → Token authentication: uses
- Scheduled jobs → Price service: runs price updates (evidence: `server/server.js`)
- Scheduled jobs → Alert checker: starts checker (evidence: `server/server.js`)
- Alert checker → Asset records: reads market data (evidence: `server/jobs/alertChecker.js`)
- Alert checker → Notifications: sends notifications (evidence: `server/jobs/alertChecker.js`)
- Price service → Asset records: updates prices (evidence: `server/services/priceService.js`)
- Price service → ML service bridge: requests market data (evidence: `server/services/priceService.js`)
- Scheduled jobs → Forecast records: stores forecasts (evidence: `server/jobs/predictionRunner.js`)
- Scheduled jobs → ML service bridge: runs forecasts (evidence: `server/jobs/predictionRunner.js`)
- Yahoo history fetcher → Yahoo Finance: fetches history (evidence: `server/services/yahooFinanceService.js`)
- ML service bridge → Python prediction API: calls prediction API (evidence: `server/services/mlBridge.js`)
- Python prediction API → Forecast inference: uses inference (evidence: `ml/api_server.py`)
- Python prediction API → Model retraining: runs retraining (evidence: `ml/api_server.py`)
- Forecast inference → Feature preparation: prepares features (evidence: `ml/predict.py`)
- Model retraining → Feature preparation: prepares training data (evidence: `ml/retrain_pipeline.py`)
- Asset records → MongoDB: persists records
- Forecast records → MongoDB: persists records
- User records → MongoDB: persists records
