A full-stack academic tracking application that combines:
- A student-focused frontend for managing grades, events, and academic profile
- A Node.js/Express backend that provides a JWT-protected API backed by MongoDB
- A Python/Flask ML service that predicts an exam score and returns personalized study recommendations
- The user authenticates with the Node backend (JWT).
- The frontend uses the JWT to call protected backend endpoints (grades, events, academic profile).
- The user opens the AI Prediction page and submits habit/lifestyle inputs.
- The frontend calls the ML service (
/predict) without using the JWT. - The ML service computes features, scales them, predicts
predicted_score, and returnsrecommendations. - The frontend displays the predicted score and saves the prediction history locally in the browser.
-
client/(React + Vite)- UI, pages, and components
- API clients for backend and ML service
-
server/(Node.js + Express + MongoDB)- REST API for auth, grades, events, academic profile
-
ml/(Python Flask)- Model inference and recommendation generation
-
Root files
README.md(this document)Contribution.md
- Provides the UI for login/signup and the main academic dashboard.
- Manages grades and event scheduling via the backend API.
- Provides the AI Prediction page that calls the ML service.
-
client/src/utils/api.jsAPI_URL(backend): configured viaVITE_API_URLwith a code fallback.mlApi(ML service): configured viaVITE_ML_API_URLwith a code fallback.- Backend calls attach
Authorization: Bearer <token>fromlocalStorage/sessionStorage. - ML calls do not require auth.
-
client/src/pages/Prediction.jsx- Builds the request payload from the prediction form
- Calls
mlApi.post('/predict', payload) - Stores prediction history in
localStorageunderprediction_history
- Hosts a REST API under
/api/*. - Uses MongoDB (Mongoose models) for persistence.
- Secures routes using JWT.
server/server.js- Loads environment variables (
dotenv) - Connects to MongoDB (
server/config/database.js) - Configures CORS for local and known production origins
- Mounts routes:
/api/health/api/auth/api/events/api/grades/api/academic
- Loads environment variables (
server/config/database.js- Connects to
process.env.MONGODB_URI
- Connects to
server/middleware/JWTauthentication.jsprotectmiddleware validates theAuthorization: Bearer ...JWT- Loads the user and attaches it to
req.user - Rejects requests for inactive users
authorize(...roles)enforces role-based access for certain routes (e.g., admin)
-
server/routes/authRoutes.jsPOST /api/auth/signupPOST /api/auth/loginPOST /api/auth/verify-emailGET /api/auth/verify(protected)GET /api/auth/me(protected)GET/PUT /api/auth/profile/:id(protected)
-
server/controllers/authController.js- JWT generation uses
process.env.JWT_SECRET - Login returns
{ token, user, expiresIn }
- JWT generation uses
-
server/routes/eventRoutes.js- Protected routes via
router.use(protect) GET /api/eventsPOST /api/eventsPUT /api/events/:idDELETE /api/events/:idGET /api/events/search?q=...
- Protected routes via
-
server/controllers/eventController.js- Ensures event ownership for update/delete
-
server/models/Event.js- Event schema includes
title,description,start,end,category,user - Validates
end > start
- Event schema includes
server/routes/gradeRoutes.js- Protected routes via
protect POST /api/gradesGET /api/gradesPUT /api/grades/:idDELETE /api/grades/:id
- Protected routes via
-
server/routes/academicRoutes.js- Protected CRUD routes:
GET /api/academicPOST /api/academicPUT /api/academicDELETE /api/academicPOST /api/academic/upsert
- Admin-only:
GET /api/academic/stats
- Protected CRUD routes:
-
server/controllers/academicController.js- Creates/updates academic records for the authenticated user
- Enforces uniqueness rules (e.g., URN/Roll Number)
-
server/models/Academic.jsgradingSystemenum:cgpa,gpa,percentage- Uniqueness constraints:
userIdis uniqueurnNumberis unique
- Includes a virtual
gradingSystemDisplay
server/middleware/errorHandler.js- Provides centralized 404/notFound and error responses
- Provides prediction and recommendation logic.
- Loads a trained model and a scaler:
student_model.pklscaler.pkl
ml/app.py- Flask app with CORS enabled
POST /predict
- The endpoint expects JSON inputs from the frontend (see
client/src/pages/Prediction.jsx). - It computes:
productivity_score(feature engineering)sleep_category(bucketed fromsleep_hours)
- It then:
- Scales features using
scaler.transform(...) - Predicts exam score with
model.predict(...) - Generates
recommendationsbased on thresholds (e.g., low score / low attendance / low sleep)
- Scales features using
ml/main.py- Reads
student_habits_performance.csv - Trains and compares models
- Runs
GridSearchCV - Saves:
student_model.pklscaler.pkl
- Reads
VITE_API_URL- Base URL of the backend Node API
VITE_ML_API_URL- Base URL of the ML Flask service
MONGODB_URIJWT_SECRETJWT_EXPIRE(optional; defaults to7din code)
- No explicit env vars used in
ml/app.py - Requires
student_model.pklandscaler.pklin theml/directory
- Start MongoDB and set
MONGODB_URIforserver. - Start the backend:
cd servernpm installnpm run dev(ornode server.js)
- Start the ML service:
cd ml- create a Python virtual environment
pip install -r requirements.txtpython app.py
- Start the frontend:
cd clientnpm installnpm run dev
Read Contribution.md and open issues to see where help is needed.