How mithleshy885/stock-prediction-portal works
This repository implements a stock-prediction portal: a React frontend supports account registration and login, then exposes a protected dashboard; a Django REST backend provides account/token endpoints and a stock-prediction endpoint. The prediction handler fetches market history, generates chart outputs, runs a bundled Keras model, and returns prediction metrics. The frontend dashboard currently calls the protected-data endpoint, not the prediction endpoint. Several frontend and backend relationships are explicit in the sampled files; unsampled wiring is not inferred.
Main entry points: App.jsx Routes and layout · views.py Prediction handler · urls.py API routes · Login.jsx Login form
Components 21
React frontend
- React entry
frontend-react/src/main.jsx - Routes and layout
frontend-react/src/App.jsx - Auth state
frontend-react/src/AuthProvider.jsx - Route guards
frontend-react/src/PrivateRoute.jsx - Registration form
frontend-react/src/components/Register.jsx - Login form
frontend-react/src/components/Login.jsx - Account navigation
frontend-react/src/components/Header.jsx - Dashboard
frontend-react/src/components/dashboard/Dashboard.jsx - HTTP client
frontend-react/src/axiosInstance.js
Accounts and access
- API routes
backend-drf/api/urls.py - Registration API
backend-drf/accounts/views.py - User serializer
backend-drf/accounts/serializers.py - User records
backend-drf/accounts/serializers.py - Protected API
backend-drf/accounts/views.py - JWT token endpoints
backend-drf/api/urls.py
Stock prediction
- Prediction handler
backend-drf/api/views.py - Market history
- Keras model
backend-drf/stock_prediction_model.keras - Plot saving
backend-drf/api/utils.py
Other components
- Portal user
- Yahoo Finance
Connections 22
- Portal user → React entry: opens portal
frontend-react/src/main.jsx - React entry → Routes and layout: renders
frontend-react/src/main.jsx - Routes and layout → Auth state: wraps routes
frontend-react/src/App.jsx - Routes and layout → Registration form: routes to
frontend-react/src/App.jsx - Routes and layout → Login form: routes to
frontend-react/src/App.jsx - Routes and layout → Dashboard: routes to
frontend-react/src/App.jsx - Routes and layout → Route guards: guards routes
frontend-react/src/App.jsx - Login form → Auth state: updates login
frontend-react/src/components/Login.jsx - Account navigation → Auth state: reads state
frontend-react/src/components/Header.jsx - Registration form → API routes: posts registration
frontend-react/src/components/Register.jsx - Login form → JWT token endpoints: requests tokens
frontend-react/src/components/Login.jsx - Dashboard → HTTP client: calls through
frontend-react/src/components/dashboard/Dashboard.jsx - Dashboard → Protected API: requests protected data
frontend-react/src/components/dashboard/Dashboard.jsx - API routes → Registration API: routes registration
backend-drf/api/urls.py - API routes → Protected API: routes protected view
backend-drf/api/urls.py - API routes → JWT token endpoints: registers token routes
backend-drf/api/urls.py - Registration API → User serializer: serializes users
backend-drf/accounts/views.py - User serializer → User records: creates user
backend-drf/accounts/serializers.py - Prediction handler → Yahoo Finance: downloads history
backend-drf/api/views.py - Prediction handler → Market history: processes prices
backend-drf/api/views.py - Prediction handler → Keras model: loads and predicts
backend-drf/api/views.py - Prediction handler → Plot saving: saves charts
backend-drf/api/views.py