A complete full-stack attendance management system with role-based access control.
- FastAPI - Modern Python web framework
- SQLAlchemy - ORM for database operations
- SQLite - Database
- JWT - Authentication
- Passlib - Password hashing
- Python 3.8+
- React 18 - UI framework
- Vite - Build tool
- React Router v6 - Routing
- Axios - HTTP client
- Tailwind CSS - Styling
- JavaScript
- Admin - Manage teachers, students, classes, and view reports
- Teacher - Mark attendance and view class reports
- Student - View personal attendance records and percentages
- JWT-based authentication
- Role-based access control
- User management (create teachers and students)
- Class management
- Attendance marking and tracking
- Attendance reports with percentages
- Same-day attendance editing
-
Analytics & Insights
- Real-time overview with key metrics (students, teachers, classes, today's attendance)
- Weekly/Monthly attendance trend charts
- Class-wise attendance comparison bar charts
- Teacher performance and consistency tracking
- Today's attendance pie chart (Present vs Absent)
-
** Alert System**
- Auto-detect students below 75% attendance
- Severity levels (Critical <50%, Warning <75%)
- Quick actions (Notify teacher, Send warning, Export report)
- Real-time notification center with bell icon
-
** Modern UI/UX**
- Collapsible sidebar navigation
- Dark mode / Light mode toggle
- Modern Education Blue theme (#2563EB)
- Smooth transitions and hover effects
- Responsive design for all screen sizes
- Search functionality
- Professional dashboard layout
-
** Visual Charts**
- Line chart for attendance trends
- Bar chart for class comparison
- Pie chart for present/absent ratio
- Interactive chart.js visualizations
-
Teacher Management
- View all teachers and their performance
- Classes handled per teacher
- Total sessions marked
- Last activity tracking
- Attendance marking consistency
- Python 3.8 or higher
- Node.js 16 or higher
- npm or yarn
- Navigate to the backend directory:
cd backend- Create and activate a virtual environment:
# Windows
python -m venv venv
venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Run the server:
python main.pyThe API will be available at: http://localhost:8000 API Documentation: http://localhost:8000/docs
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Run the development server:
npm run devThe application will be available at: http://localhost:5173
The system creates default users on first startup:
-
Admin
- Email: admin@example.com
- Password: admin123
-
Teacher
- Email: teacher@example.com
- Password: teacher123
-
Student
- Email: student@example.com
- Password: student123
attendence system/
├── backend/
│ ├── routers/
│ │ ├── auth.py # Authentication routes
│ │ ├── admin.py # Admin routes
│ │ ├── teacher.py # Teacher routes
│ │ └── student.py # Student routes
│ ├── main.py # FastAPI application
│ ├── database.py # Database configuration
│ ├── models.py # SQLAlchemy models
│ ├── schemas.py # Pydantic schemas
│ ├── auth.py # Authentication utilities
│ ├── dependencies.py # Route dependencies
│ ├── requirements.txt # Python dependencies
│ └── README.md
│
└── frontend/
├── src/
│ ├── components/ # Reusable components
│ ├── pages/ # Page components
│ ├── services/ # API services
│ ├── routes.jsx # Route configuration
│ ├── App.jsx # Main app component
│ └── main.jsx # Entry point
├── package.json
├── vite.config.js
├── tailwind.config.js
└── README.md
POST /api/auth/login- User loginPOST /api/auth/register- User registration
POST /api/admin/teachers- Create teacherPOST /api/admin/students- Create studentGET /api/admin/teachers- Get all teachersGET /api/admin/students- Get all studentsPOST /api/admin/classes- Create classGET /api/admin/classes- Get all classesPOST /api/admin/assign-student- Assign student to classGET /api/admin/classes/{class_id}/students- Get students in classGET /api/admin/reports/class/{class_id}- Class attendance reportGET /api/admin/reports/student/{student_id}- Student attendance reportGET /api/admin/analytics/overview- Dashboard overview statisticsGET /api/admin/analytics/attendance-trends- Weekly/Monthly trendsGET /api/admin/analytics/class-comparison- Class-wise comparisonGET /api/admin/analytics/teacher-consistency- Teacher performance dataGET /api/admin/analytics/low-attendance-alerts- Students below thresholdGET /api/admin/notifications- System notifications and alerts
GET /api/teacher/classes- Get my classesGET /api/teacher/classes/{class_id}/students- Get class studentsPOST /api/teacher/attendance- Mark attendancePUT /api/teacher/attendance/{attendance_id}- Update attendanceGET /api/teacher/attendance/{class_id}/history- Get attendance historyGET /api/teacher/attendance/{class_id}/date/{date}- Get attendance by dateGET /api/teacher/reports/{class_id}- Get class report
GET /api/student/attendance- Get my attendance recordsGET /api/student/attendance/percentage- Get my attendance percentageGET /api/student/classes- Get my classes
- Login with admin credentials
- Create teachers and students
- Create classes and assign teachers
- Assign students to classes
- View attendance reports
- Login with teacher credentials
- View assigned classes
- Mark attendance for students
- View attendance reports
- Login with student credentials
- View attendance summary with percentages
- View detailed attendance records
- id (Primary Key)
- name
- email (Unique)
- password_hash
- role (admin/teacher/student)
- id (Primary Key)
- name
- teacher_id (Foreign Key)
- id (Primary Key)
- student_id (Foreign Key)
- class_id (Foreign Key)
- id (Primary Key)
- student_id (Foreign Key)
- class_id (Foreign Key)
- date
- status (present/absent)
- JWT token-based authentication
- Password hashing with bcrypt
- Role-based access control
- Protected API endpoints
- Secure credential storage
Backend tests can be added using pytest:
cd backend
pytestBackend:
cd backend
# Use a production WSGI server like gunicorn
gunicorn main:appFrontend:
cd frontend
npm run build- Ensure Python 3.8+ is installed
- Check if port 8000 is available
- Verify all dependencies are installed
- Ensure Node.js 16+ is installed
- Check if port 5173 is available
- Clear node_modules and reinstall:
rm -rf node_modules && npm install
- Backend CORS is configured for localhost:5173 and localhost:3000
- Modify
main.pyto add additional origins if needed
This project is created for educational purposes.
For issues or questions, please check the documentation or create an issue in the repository. for forntend step1:cd frontend; npm install step2:npm run dev
backend: cd "C:\Users\KAVANA M\Desktop\attendence system\backend"; & "..\venv\Scripts\Activate.ps1"; python -m uvicorn main:app --reload