Skip to content

deepu2826/Attendify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Attendify — Attendance Management System for Rural Schools

A full-stack, production-ready attendance management system built for rural schools with offline-first support.


📁 Project Structure

attendify/
├── backend/                    # Node.js + Express API
│   ├── controllers/            # Business logic
│   │   ├── authController.js
│   │   ├── studentController.js
│   │   ├── attendanceController.js
│   │   ├── classController.js
│   │   ├── reportController.js
│   │   └── userController.js
│   ├── middleware/
│   │   ├── auth.js             # JWT middleware
│   │   └── errorHandler.js
│   ├── models/                 # Mongoose schemas
│   │   ├── User.js
│   │   ├── Student.js
│   │   ├── Class.js
│   │   ├── Attendance.js
│   │   └── Report.js
│   ├── routes/
│   │   ├── auth.js
│   │   ├── students.js
│   │   ├── classes.js
│   │   ├── attendance.js
│   │   ├── reports.js
│   │   └── users.js
│   ├── scripts/
│   │   └── seedDatabase.js     # 100 student seed data
│   ├── .env.example
│   ├── package.json
│   └── server.js
│
├── frontend/                   # React.js + Tailwind CSS
│   ├── public/
│   │   ├── index.html
│   │   └── manifest.json       # PWA manifest
│   ├── src/
│   │   ├── components/
│   │   │   └── common/
│   │   │       └── Layout.js   # Sidebar layout
│   │   ├── context/
│   │   │   └── AuthContext.js  # Auth state
│   │   ├── hooks/
│   │   │   └── useOfflineSync.js  # Offline/online sync
│   │   ├── pages/
│   │   │   ├── admin/          # Admin dashboard + management
│   │   │   ├── teacher/        # Teacher portal + attendance marking
│   │   │   ├── student/        # Student view
│   │   │   ├── parent/         # Parent view
│   │   │   └── LoginPage.js
│   │   ├── services/
│   │   │   └── api.js          # Axios API service
│   │   └── utils/
│   │       └── offlineStorage.js  # IndexedDB offline storage
│   └── package.json
│
└── README.md

🚀 Quick Setup (Step-by-Step)

Prerequisites

  • Node.js >= 16
  • MongoDB (local or MongoDB Atlas)
  • npm or yarn

Step 1 — Clone & Install

# Install backend dependencies
cd attendify/backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

Step 2 — Configure Environment

cd backend
cp .env.example .env

Edit .env:

PORT=5000
MONGODB_URI=mongodb://localhost:27017/attendify
JWT_SECRET=your_very_secret_key_here
JWT_EXPIRE=7d
NODE_ENV=development
FRONTEND_URL=http://localhost:3000

For MongoDB Atlas:

MONGODB_URI=mongodb+srv://<user>:<pass>@cluster0.mongodb.net/attendify?retryWrites=true&w=majority

Step 3 — Seed the Database (100 Students + Demo Data)

cd backend
npm run seed

This creates:

  • ✅ 1 Admin account
  • ✅ 5 Teacher accounts
  • ✅ 5 Classes (Grade 6–10)
  • ✅ 100 Student records with randomized attendance history (60 days)
  • ✅ 100 Parent accounts

Step 4 — Start Backend

cd backend
npm run dev     # Development (with nodemon)
# or
npm start       # Production

Backend runs on: http://localhost:5000


Step 5 — Start Frontend

cd frontend
npm start

Frontend runs on: http://localhost:3000


🔑 Demo Login Credentials

Role Email Password
Admin admin@attendify.com Admin@123
Teacher rajesh@attendify.com Teacher@123
Teacher priya@attendify.com Teacher@123
Student (any student email in DB) Student@123
Parent parent.1@gmail.com Parent@123

📡 API Endpoints

Auth

Method Endpoint Description Access
POST /api/auth/login Login Public
POST /api/auth/signup Register Public
GET /api/auth/me Get current user All
PUT /api/auth/change-password Change password All

Students

Method Endpoint Description Access
GET /api/students List students All
GET /api/students/:id Get single student All
GET /api/students/:id/attendance Student attendance All
POST /api/students Create student Admin, Teacher
PUT /api/students/:id Update student Admin, Teacher
DELETE /api/students/:id Deactivate student Admin

Classes

Method Endpoint Description Access
GET /api/classes List classes All
GET /api/classes/:id Get class All
POST /api/classes Create class Admin
PUT /api/classes/:id Update class Admin
DELETE /api/classes/:id Delete class Admin

Attendance

Method Endpoint Description Access
GET /api/attendance List records All
GET /api/attendance/:classId/:date Class attendance All
GET /api/attendance/stats/:classId Class stats All
POST /api/attendance/mark Mark attendance Admin, Teacher
POST /api/attendance/sync Sync offline data Admin, Teacher

Reports

Method Endpoint Description Access
GET /api/reports/dashboard Dashboard stats All
GET /api/reports/generate Generate report All
GET /api/reports/export/excel Export Excel All
GET /api/reports/export/pdf Export PDF All

Users (Admin only)

Method Endpoint Description
GET /api/users List users
POST /api/users Create user
PUT /api/users/:id Update user
DELETE /api/users/:id Delete user

🗄️ Database Collections

Users

{ name, email, password (bcrypt), role: ['admin','teacher','student','parent'],
  phone, isActive, employeeId, assignedClasses, studentId, classId, parentId, children, lastLogin }

Students

{ studentId, name, email, phone, dateOfBirth, gender, address,
  classId (→Class), parentId (→User), userId (→User),
  enrollmentDate, isActive,
  attendanceSummary: { totalDays, presentDays, absentDays, percentage } }

Classes

{ name, section, grade, academicYear, teacherId (→User),
  studentCount, subjects[], schedule[], isActive }

Attendance

{ classId (→Class), teacherId (→User), date, subject,
  records: [{ studentId, status: ['present','absent','late','excused'], remarks }],
  totalPresent, totalAbsent, totalStudents, isSynced }

Reports

{ type: ['daily','weekly','monthly','custom'], generatedBy (→User),
  classId, studentId, dateFrom, dateTo, data, format, title }

✨ Key Features

📵 Offline-First (IndexedDB)

  • Mark attendance without internet
  • Data stored in browser IndexedDB
  • Auto-syncs when connection restored
  • Visual pending count in sidebar

📊 Reports & Export

  • Generate class-wise attendance reports
  • Export to Excel (.xlsx) with color coding
  • Export to PDF with formatted tables
  • Chart.js visualizations (bar, line, doughnut)

🔐 Role-Based Access

  • Admin: Full control — users, classes, students, reports
  • Teacher: Mark attendance, view students, generate reports
  • Student: View own attendance, eligibility status, calendar
  • Parent: View child's attendance, download reports

📱 PWA Support

  • Installable on mobile devices
  • Offline capability
  • App-like experience

🛠️ Tech Stack

Layer Technology
Frontend React 18, Tailwind CSS, Chart.js
Backend Node.js, Express.js
Database MongoDB, Mongoose ODM
Auth JWT, bcryptjs
Offline IndexedDB
Export ExcelJS, PDFKit
PWA Web App Manifest

🏗️ Production Deployment

Backend (e.g., Railway, Render, Heroku)

cd backend
npm start
# Set environment variables in your hosting dashboard

Frontend (e.g., Vercel, Netlify)

cd frontend
npm run build
# Deploy the /build folder
# Set REACT_APP_API_URL=https://your-backend-url.com/api

🔒 Security

  • Passwords hashed with bcrypt (12 salt rounds)
  • JWT tokens with expiry
  • Role-based middleware on all routes
  • Input validation on all endpoints
  • CORS configured for specific origin

Built with ❤️ for rural schools — works everywhere, even offline.

About

A full-stack, production-ready attendance management system built for rural schools with offline-first support.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors