# sarang19114/pred architecture

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

- Interactive diagram: https://gitdiagram.com/sarang19114/pred
- Repository: https://github.com/sarang19114/pred

## Overview

Stocket combines a React stock-analysis experience, Flask API, Mongo-backed account features, and separate statistical/ML and deep-learning prediction services. The user-facing workflow spans account access, stock lookup and dashboard analysis, watchlist tracking, and next-day forecasts; learning, chatbot, support, feedback, and profile capabilities are also represented. Source excerpts establish server routing and prediction dispatch, but do not show how client pages call the APIs, so those links are left unasserted.

Main entry points: [`server/routes.py`](https://github.com/sarang19114/pred/blob/main/server/routes.py) (API routes), [`client/src/App.tsx`](https://github.com/sarang19114/pred/blob/main/client/src/App.tsx) (Route shell), [`server/models.py`](https://github.com/sarang19114/pred/blob/main/server/models.py) (Mongo data models), [`server/utils/User/profile.py`](https://github.com/sarang19114/pred/blob/main/server/utils/User/profile.py) (Profile management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Route shell<br/>[App.tsx]"]
  node_authpages["Sign-in and signup<br/>[Signin.tsx]"]
  node_dashboard["Stock dashboard<br/>[Dashboard.tsx]"]
  node_watchpage["Watchlist page<br/>[Watchlist.tsx]"]
  node_predictionpages["Forecast pages"]
  node_learning["Learning section"]
  node_chatbot["Market chatbot<br/>[Chatbot.tsx]"]
  node_profilepage["Profile page"]
  node_support["Support page<br/>[support.tsx]"]
  node_contactform["Contact form<br/>[Contact.tsx]"]
  node_feedbackform["Feedback form<br/>[FeedbackForm.tsx]"]
  node_settings["Account settings"]
end

subgraph group_api["Core API"]
  node_apiapp["Flask API<br/>[app.py]"]
  node_routes["API routes<br/>[routes.py]"]
end

subgraph group_accounts["Accounts and engagement"]
  node_auth["Authentication<br/>[auth.py]"]
  node_profile["Profile management<br/>[profile.py]"]
  node_watchlist["Watchlist management<br/>[watchlist.py]"]
  node_contact["Contact storage<br/>[contact.py]"]
  node_feedback["Feedback storage<br/>[feedback.py]"]
  node_chat["Chat service<br/>[chat.py]"]
  node_models[("Mongo data models<br/>[models.py]")]
end

subgraph group_market["Market data"]
  node_stock["Stock lookup<br/>[stock.py]"]
end

subgraph group_forecast["Forecast services"]
  node_mlapp["ML API<br/>[app.py]"]
  node_dlapp["Deep-learning API<br/>[app.py]"]
  node_arima["ARIMA forecast"]
  node_forest["Random Forest forecast"]
  node_lstm["LSTM forecast<br/>[LSTM_prediction.py]"]
  node_gru["GRU forecast<br/>[GRU_prediction.py]"]
end

node_user(("Investor"))
node_yfinance["Yahoo Finance"]
node_gemini["Gemini API"]
node_cloudinary["Cloudinary"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authpages
node_app -->|"routes to"| node_watchpage
node_app -->|"routes to"| node_profilepage
node_app -->|"routes to"| node_support
node_apiapp -->|"registers"| node_routes
node_routes -->|"dispatches"| node_auth
node_routes -->|"dispatches"| node_stock
node_routes -->|"dispatches"| node_profile
node_routes -->|"dispatches"| node_watchlist
node_routes -->|"dispatches"| node_contact
node_routes -->|"dispatches"| node_feedback
node_routes -->|"dispatches"| node_chat
node_auth -->|"reads and writes"| node_models
node_profile -->|"reads and writes"| node_models
node_profile -->|"uploads images"| node_cloudinary
node_watchlist -->|"updates"| node_models
node_contact -->|"saves messages"| node_models
node_feedback -->|"saves feedback"| node_models
node_stock -->|"fetches quotes"| node_yfinance
node_mlapp -->|"dispatches"| node_arima
node_mlapp -->|"dispatches"| node_forest
node_dlapp -->|"dispatches"| node_lstm
node_dlapp -->|"dispatches"| node_gru
node_lstm -->|"fetches history"| node_yfinance
node_forest -->|"fetches prices"| node_yfinance
node_chat -.->|"market insights"| node_gemini
node_dashboard -.->|"loads stock data"| node_apiapp
node_predictionpages -.->|"requests forecasts"| node_mlapp
node_predictionpages -.->|"requests forecasts"| node_dlapp

click node_app "https://github.com/sarang19114/pred/blob/main/client/src/App.tsx"
click node_authpages "https://github.com/sarang19114/pred/blob/main/client/src/pages/Signin.tsx"
click node_dashboard "https://github.com/sarang19114/pred/blob/main/client/src/components/Dashboard/Dashboard.tsx"
click node_watchpage "https://github.com/sarang19114/pred/blob/main/client/src/pages/Watchlist.tsx"
click node_predictionpages "https://github.com/sarang19114/pred/blob/main/client/src/components/Prediction/PredictionTechniques.tsx"
click node_learning "https://github.com/sarang19114/pred/blob/main/client/src/components/Learning/LearningComponent.tsx"
click node_chatbot "https://github.com/sarang19114/pred/blob/main/client/src/components/Chatbot/Chatbot.tsx"
click node_profilepage "https://github.com/sarang19114/pred/blob/main/client/src/components/Profile/ProfileComponent.tsx"
click node_support "https://github.com/sarang19114/pred/blob/main/client/src/pages/support.tsx"
click node_contactform "https://github.com/sarang19114/pred/blob/main/client/src/components/Contact/Contact.tsx"
click node_feedbackform "https://github.com/sarang19114/pred/blob/main/client/src/components/Feedback/FeedbackForm.tsx"
click node_settings "https://github.com/sarang19114/pred/blob/main/client/src/components/Settings/AccountSettings.tsx"
click node_apiapp "https://github.com/sarang19114/pred/blob/main/server/app.py"
click node_routes "https://github.com/sarang19114/pred/blob/main/server/routes.py"
click node_auth "https://github.com/sarang19114/pred/blob/main/server/utils/Auth/auth.py"
click node_profile "https://github.com/sarang19114/pred/blob/main/server/utils/User/profile.py"
click node_watchlist "https://github.com/sarang19114/pred/blob/main/server/utils/Watchlist/watchlist.py"
click node_contact "https://github.com/sarang19114/pred/blob/main/server/utils/Contact/contact.py"
click node_feedback "https://github.com/sarang19114/pred/blob/main/server/utils/Feedback/feedback.py"
click node_chat "https://github.com/sarang19114/pred/blob/main/server/utils/Chat/chat.py"
click node_models "https://github.com/sarang19114/pred/blob/main/server/models.py"
click node_stock "https://github.com/sarang19114/pred/blob/main/server/utils/Stock/stock.py"
click node_mlapp "https://github.com/sarang19114/pred/blob/main/prediction/MLModels/app.py"
click node_dlapp "https://github.com/sarang19114/pred/blob/main/prediction/DLModels/app.py"
click node_arima "https://github.com/sarang19114/pred/blob/main/prediction/MLModels/utils/ARIMA_prediction.py"
click node_forest "https://github.com/sarang19114/pred/blob/main/prediction/MLModels/utils/RANDOMFOREST_prediction.py"
click node_lstm "https://github.com/sarang19114/pred/blob/main/prediction/DLModels/utils/LSTM_prediction.py"
click node_gru "https://github.com/sarang19114/pred/blob/main/prediction/DLModels/utils/GRU_prediction.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_app,node_authpages,node_dashboard,node_watchpage,node_predictionpages,node_learning,node_chatbot,node_profilepage,node_support,node_contactform,node_feedbackform,node_settings toneBlue
class node_apiapp,node_routes toneAmber
class node_auth,node_profile,node_watchlist,node_contact,node_feedback,node_chat,node_models,node_gemini toneMint
class node_stock toneRose
class node_mlapp,node_dlapp,node_arima,node_forest,node_lstm,node_gru,node_user,node_yfinance,node_cloudinary toneIndigo
```

## Components

### Web client

- [Route shell](https://github.com/sarang19114/pred/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Sign-in and signup](https://github.com/sarang19114/pred/blob/main/client/src/pages/Signin.tsx): `client/src/pages/Signin.tsx`
- [Stock dashboard](https://github.com/sarang19114/pred/blob/main/client/src/components/Dashboard/Dashboard.tsx): `client/src/components/Dashboard/Dashboard.tsx`
- [Watchlist page](https://github.com/sarang19114/pred/blob/main/client/src/pages/Watchlist.tsx): `client/src/pages/Watchlist.tsx`
- [Forecast pages](https://github.com/sarang19114/pred/blob/main/client/src/components/Prediction/PredictionTechniques.tsx): `client/src/components/Prediction/PredictionTechniques.tsx`
- [Learning section](https://github.com/sarang19114/pred/blob/main/client/src/components/Learning/LearningComponent.tsx): `client/src/components/Learning/LearningComponent.tsx`
- [Market chatbot](https://github.com/sarang19114/pred/blob/main/client/src/components/Chatbot/Chatbot.tsx): `client/src/components/Chatbot/Chatbot.tsx`
- [Profile page](https://github.com/sarang19114/pred/blob/main/client/src/components/Profile/ProfileComponent.tsx): `client/src/components/Profile/ProfileComponent.tsx`
- [Support page](https://github.com/sarang19114/pred/blob/main/client/src/pages/support.tsx): `client/src/pages/support.tsx`
- [Contact form](https://github.com/sarang19114/pred/blob/main/client/src/components/Contact/Contact.tsx): `client/src/components/Contact/Contact.tsx`
- [Feedback form](https://github.com/sarang19114/pred/blob/main/client/src/components/Feedback/FeedbackForm.tsx): `client/src/components/Feedback/FeedbackForm.tsx`
- [Account settings](https://github.com/sarang19114/pred/blob/main/client/src/components/Settings/AccountSettings.tsx): `client/src/components/Settings/AccountSettings.tsx`

### Core API

- [Flask API](https://github.com/sarang19114/pred/blob/main/server/app.py): `server/app.py`
- [API routes](https://github.com/sarang19114/pred/blob/main/server/routes.py): `server/routes.py`

### Accounts and engagement

- [Authentication](https://github.com/sarang19114/pred/blob/main/server/utils/Auth/auth.py): `server/utils/Auth/auth.py`
- [Profile management](https://github.com/sarang19114/pred/blob/main/server/utils/User/profile.py): `server/utils/User/profile.py`
- [Watchlist management](https://github.com/sarang19114/pred/blob/main/server/utils/Watchlist/watchlist.py): `server/utils/Watchlist/watchlist.py`
- [Contact storage](https://github.com/sarang19114/pred/blob/main/server/utils/Contact/contact.py): `server/utils/Contact/contact.py`
- [Feedback storage](https://github.com/sarang19114/pred/blob/main/server/utils/Feedback/feedback.py): `server/utils/Feedback/feedback.py`
- [Chat service](https://github.com/sarang19114/pred/blob/main/server/utils/Chat/chat.py): `server/utils/Chat/chat.py`
- [Mongo data models](https://github.com/sarang19114/pred/blob/main/server/models.py): `server/models.py`

### Market data

- [Stock lookup](https://github.com/sarang19114/pred/blob/main/server/utils/Stock/stock.py): `server/utils/Stock/stock.py`

### Forecast services

- [ML API](https://github.com/sarang19114/pred/blob/main/prediction/MLModels/app.py): `prediction/MLModels/app.py`
- [Deep-learning API](https://github.com/sarang19114/pred/blob/main/prediction/DLModels/app.py): `prediction/DLModels/app.py`
- [ARIMA forecast](https://github.com/sarang19114/pred/blob/main/prediction/MLModels/utils/ARIMA_prediction.py): `prediction/MLModels/utils/ARIMA_prediction.py`
- [Random Forest forecast](https://github.com/sarang19114/pred/blob/main/prediction/MLModels/utils/RANDOMFOREST_prediction.py): `prediction/MLModels/utils/RANDOMFOREST_prediction.py`
- [LSTM forecast](https://github.com/sarang19114/pred/blob/main/prediction/DLModels/utils/LSTM_prediction.py): `prediction/DLModels/utils/LSTM_prediction.py`
- [GRU forecast](https://github.com/sarang19114/pred/blob/main/prediction/DLModels/utils/GRU_prediction.py): `prediction/DLModels/utils/GRU_prediction.py`

### Other components

- **Investor**
- **Yahoo Finance**
- **Gemini API**
- **Cloudinary**

## Connections

- Investor → Route shell: uses
- Route shell → Sign-in and signup: routes to (evidence: `client/src/App.tsx`)
- Route shell → Watchlist page: routes to (evidence: `client/src/App.tsx`)
- Route shell → Profile page: routes to (evidence: `client/src/App.tsx`)
- Route shell → Support page: routes to (evidence: `client/src/App.tsx`)
- Flask API → API routes: registers (evidence: `server/app.py`)
- API routes → Authentication: dispatches (evidence: `server/routes.py`)
- API routes → Stock lookup: dispatches (evidence: `server/routes.py`)
- API routes → Profile management: dispatches (evidence: `server/routes.py`)
- API routes → Watchlist management: dispatches (evidence: `server/routes.py`)
- API routes → Contact storage: dispatches (evidence: `server/routes.py`)
- API routes → Feedback storage: dispatches (evidence: `server/routes.py`)
- API routes → Chat service: dispatches (evidence: `server/routes.py`)
- Authentication → Mongo data models: reads and writes (evidence: `server/utils/Auth/auth.py`)
- Profile management → Mongo data models: reads and writes (evidence: `server/utils/User/profile.py`)
- Profile management → Cloudinary: uploads images (evidence: `server/utils/User/profile.py`)
- Watchlist management → Mongo data models: updates (evidence: `server/models.py`)
- Contact storage → Mongo data models: saves messages (evidence: `server/utils/Contact/contact.py`)
- Feedback storage → Mongo data models: saves feedback (evidence: `server/utils/Feedback/feedback.py`)
- Stock lookup → Yahoo Finance: fetches quotes (evidence: `server/utils/Stock/stock.py`)
- ML API → ARIMA forecast: dispatches (evidence: `prediction/MLModels/app.py`)
- ML API → Random Forest forecast: dispatches (evidence: `prediction/MLModels/app.py`)
- Deep-learning API → LSTM forecast: dispatches (evidence: `prediction/DLModels/app.py`)
- Deep-learning API → GRU forecast: dispatches (evidence: `prediction/DLModels/app.py`)
- LSTM forecast → Yahoo Finance: fetches history (evidence: `prediction/DLModels/utils/LSTM_prediction.py`)
- Random Forest forecast → Yahoo Finance: fetches prices (evidence: `prediction/MLModels/utils/RANDOMFOREST_prediction.py`)
- Chat service → Gemini API: market insights (evidence: `README.md`)
- Stock dashboard → Flask API: loads stock data
- Forecast pages → ML API: requests forecasts
- Forecast pages → Deep-learning API: requests forecasts
