LearnGuardian is a comprehensive 3-role academic monitoring and productivity system built with the MERN stack (MongoDB, Express.js, React, Node.js). It enables students to track their academic activities, teachers to monitor performance and receive alerts, and parents to view academic summaries.
- Log daily academic activities (assignments, reading, practice, projects)
- Start and end study sessions with time tracking
- View activity history and study session logs
- Access focus exercise suggestions for better productivity
- Real-time session tracking
- View and manage assigned students
- Monitor student activities and study sessions
- Add academic scores and grades
- Automatic academic performance alerts (20% drop detection)
- Add remarks and comments for students
- View and resolve academic alerts
- Comprehensive student performance tracking
- View child's academic summary and statistics
- Access teacher remarks and feedback
- Receive academic performance alerts
- Track performance trends by subject
- Weekly activity overview
- Study time analytics
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM for MongoDB
- JWT - Authentication
- Bcrypt.js - Password hashing
- React.js - UI framework
- Vite - Build tool
- React Router DOM - Routing
- Axios - HTTP client
- Tailwind CSS - Styling
- Context API - State management
Mini-project/
βββ backend/
β βββ config/
β β βββ db.js
β βββ controllers/
β β βββ authController.js
β β βββ studentController.js
β β βββ teacherController.js
β β βββ parentController.js
β βββ middleware/
β β βββ auth.js
β βββ models/
β β βββ User.js
β β βββ StudentActivity.js
β β βββ StudySession.js
β β βββ AcademicRecord.js
β β βββ AcademicAlert.js
β β βββ TeacherRemark.js
β βββ routes/
β β βββ ai.js
β β βββ authRoutes.js
β β βββ chatbot.js
β β βββ studentRoutes.js
β β βββ teacherRoutes.js
β β βββ parentRoutes.js
β βββ .gitignore
β βββ package.json
β βββ server.js
βββ frontend/
β βββ src/
β β βββ components/
β β β βββ Layout.jsx
β β β βββ VoiceChatbot.jsx
β β βββ context/
β β β βββ AuthContext.jsx
β β βββ pages/
β β β βββ Login.jsx
β β β βββ StudentDashboard.jsx
β β β βββ TeacherDashboard.jsx
β β β βββ ParentDashboard.jsx
β β βββ services/
β β β βββ api.js
β β βββ App.jsx
β β βββ main.jsx
β β βββ index.css
β βββ .gitignore
β βββ index.html
β βββ package.json
β βββ postcss.config.js
β βββ tailwind.config.js
β βββ vite.config.js
βββ README.md
- Node.js (v16 or higher)
- MongoDB (local or Atlas)
- npm or yarn
- Navigate to the backend directory:
cd backend- Install dependencies:
npm install- Create a
.envfile in the backend directory:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/learnguardian
JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
NODE_ENV=development- Start MongoDB (if running locally):
# On Windows
net start MongoDB
# On macOS/Linux
sudo systemctl start mongod- Start the backend server:
npm run devThe backend will run on http://localhost:5000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Start the development server:
npm run devThe frontend will run on http://localhost:3000
To get started quickly, you'll need to create demo users. You can do this by making POST requests to the register endpoint or using MongoDB directly.
Use Postman, curl, or any HTTP client to create users:
curl -X POST http://localhost:5000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "teacher1",
"password": "password123",
"role": "teacher",
"fullName": "John Doe"
}'curl -X POST http://localhost:5000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "student1",
"password": "password123",
"role": "student",
"fullName": "Jane Smith",
"assignedTeacher": "<TEACHER_ID_FROM_ABOVE>"
}'curl -X POST http://localhost:5000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "parent1",
"password": "password123",
"role": "parent",
"fullName": "Mary Smith",
"childId": "<STUDENT_ID_FROM_ABOVE>"
}'After setup, you can login with:
- Student:
student1/password123 - Teacher:
teacher1/password123 - Parent:
parent1/password123
The system automatically monitors student performance and creates alerts when:
- A student's current score is β€ 80% of their previous score in the same subject
- This represents a 20% or greater performance drop
Example: If a student scores 90 on a previous test and then scores 70 on the next test (70 β€ 90 * 0.8 = 72), an alert is automatically generated and sent to both the teacher and parent.
The application uses JWT-based authentication with role-based middleware:
- Students can only access student routes
- Teachers can only access teacher routes
- Parents can only access parent routes
Routes are protected and redirect unauthorized users.
Students can:
- Start a study session with optional subject and notes
- Only one active session at a time
- End sessions to calculate duration
- View session history
POST /api/auth/register- Register a new userPOST /api/auth/login- Login userGET /api/auth/me- Get current user (protected)
POST /api/students/activity- Create activityGET /api/students/activity/today- Get today's activitiesGET /api/students/activity- Get all activitiesPOST /api/students/session/start- Start study sessionPOST /api/students/session/end- End study sessionGET /api/students/session/active- Get active sessionGET /api/students/sessions- Get all sessionsGET /api/students/exercises- Get focus exercises
GET /api/teachers/students- Get assigned studentsGET /api/teachers/students/:id/activities- Get student activitiesGET /api/teachers/students/:id/sessions- Get student sessionsGET /api/teachers/students/:id/records- Get student recordsPOST /api/teachers/score- Add academic scorePOST /api/teachers/remark- Add remarkGET /api/teachers/alerts- Get alertsPUT /api/teachers/alerts/:id/resolve- Resolve alert
GET /api/parents/status- Get child statusGET /api/parents/remarks- Get teacher remarksGET /api/parents/alerts- Get alertsGET /api/parents/performance- Get performance data
- Set environment variables:
PORT=5000
MONGODB_URI=<your_mongodb_atlas_uri>
JWT_SECRET=<strong_secret_key>
NODE_ENV=production- Build and deploy:
git push heroku main- Build the frontend:
npm run build-
Deploy the
distfolder to your hosting service -
Update the API base URL in
frontend/vite.config.jsto point to your production backend
- Email notifications for alerts
- Data visualization charts and graphs
- Mobile app version
- Integration with external learning platforms
- AI-powered study recommendations
- Group study features
- Calendar integration
- File upload for assignments
- Real-time chat between teachers and students
- Advanced analytics dashboard
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
For issues or questions, please open an issue on the GitHub repository.
Built with β€οΈ using the MERN Stack