Skip to content

kavana262/smart-attendance-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Attendance Management System

A complete full-stack attendance management system with role-based access control.

Technology Stack

Backend

  • FastAPI - Modern Python web framework
  • SQLAlchemy - ORM for database operations
  • SQLite - Database
  • JWT - Authentication
  • Passlib - Password hashing
  • Python 3.8+

Frontend

  • React 18 - UI framework
  • Vite - Build tool
  • React Router v6 - Routing
  • Axios - HTTP client
  • Tailwind CSS - Styling
  • JavaScript

Features

User Roles

  1. Admin - Manage teachers, students, classes, and view reports
  2. Teacher - Mark attendance and view class reports
  3. Student - View personal attendance records and percentages

Core Functionality

  • 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

Enhanced Admin Dashboard Features

  • 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

Quick Start Guide

Prerequisites

  • Python 3.8 or higher
  • Node.js 16 or higher
  • npm or yarn

Backend Setup

  1. Navigate to the backend directory:
cd backend
  1. Create and activate a virtual environment:
# Windows
python -m venv venv
venv\Scripts\activate

# Linux/Mac
python3 -m venv venv
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the server:
python main.py

The API will be available at: http://localhost:8000 API Documentation: http://localhost:8000/docs

Frontend Setup

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Run the development server:
npm run dev

The application will be available at: http://localhost:5173

Default Login Credentials

The system creates default users on first startup:

Project Structure

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

API Endpoints

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/register - User registration

Admin Endpoints

  • POST /api/admin/teachers - Create teacher
  • POST /api/admin/students - Create student
  • GET /api/admin/teachers - Get all teachers
  • GET /api/admin/students - Get all students
  • POST /api/admin/classes - Create class
  • GET /api/admin/classes - Get all classes
  • POST /api/admin/assign-student - Assign student to class
  • GET /api/admin/classes/{class_id}/students - Get students in class
  • GET /api/admin/reports/class/{class_id} - Class attendance report
  • GET /api/admin/reports/student/{student_id} - Student attendance report
  • GET /api/admin/analytics/overview - Dashboard overview statistics
  • GET /api/admin/analytics/attendance-trends - Weekly/Monthly trends
  • GET /api/admin/analytics/class-comparison - Class-wise comparison
  • GET /api/admin/analytics/teacher-consistency - Teacher performance data
  • GET /api/admin/analytics/low-attendance-alerts - Students below threshold
  • GET /api/admin/notifications - System notifications and alerts

Teacher Endpoints

  • GET /api/teacher/classes - Get my classes
  • GET /api/teacher/classes/{class_id}/students - Get class students
  • POST /api/teacher/attendance - Mark attendance
  • PUT /api/teacher/attendance/{attendance_id} - Update attendance
  • GET /api/teacher/attendance/{class_id}/history - Get attendance history
  • GET /api/teacher/attendance/{class_id}/date/{date} - Get attendance by date
  • GET /api/teacher/reports/{class_id} - Get class report

Student Endpoints

  • GET /api/student/attendance - Get my attendance records
  • GET /api/student/attendance/percentage - Get my attendance percentage
  • GET /api/student/classes - Get my classes

Usage Guide

As Admin

  1. Login with admin credentials
  2. Create teachers and students
  3. Create classes and assign teachers
  4. Assign students to classes
  5. View attendance reports

As Teacher

  1. Login with teacher credentials
  2. View assigned classes
  3. Mark attendance for students
  4. View attendance reports

As Student

  1. Login with student credentials
  2. View attendance summary with percentages
  3. View detailed attendance records

Database Schema

Users Table

  • id (Primary Key)
  • name
  • email (Unique)
  • password_hash
  • role (admin/teacher/student)

Classes Table

  • id (Primary Key)
  • name
  • teacher_id (Foreign Key)

Student_Classes Table

  • id (Primary Key)
  • student_id (Foreign Key)
  • class_id (Foreign Key)

Attendance Table

  • id (Primary Key)
  • student_id (Foreign Key)
  • class_id (Foreign Key)
  • date
  • status (present/absent)

Security Features

  • JWT token-based authentication
  • Password hashing with bcrypt
  • Role-based access control
  • Protected API endpoints
  • Secure credential storage

Development

Running Tests

Backend tests can be added using pytest:

cd backend
pytest

Building for Production

Backend:

cd backend
# Use a production WSGI server like gunicorn
gunicorn main:app

Frontend:

cd frontend
npm run build

Troubleshooting

Backend Issues

  • Ensure Python 3.8+ is installed
  • Check if port 8000 is available
  • Verify all dependencies are installed

Frontend Issues

  • Ensure Node.js 16+ is installed
  • Check if port 5173 is available
  • Clear node_modules and reinstall: rm -rf node_modules && npm install

CORS Issues

  • Backend CORS is configured for localhost:5173 and localhost:3000
  • Modify main.py to add additional origins if needed

License

This project is created for educational purposes.

Support

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

About

A Smart Attendance System is a full-stack web application designed to digitize and automate the attendance management process for educational institutions. The system provides role-based dashboards for Admin, Teachers, and Students, ensuring secure access, transparency, and efficient attendance tracking.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors