"Attendance, verified."
An enterprise-grade, zero-trust attendance ecosystem that eliminates proxy attendance, screenshot sharing, replay attacks, and academic attendance fraud using dynamic cryptographic QR codes and a 7-layer server-side verification engine.
Live Demo Links • Architecture • 7-Layer Security • Gamification • Quickstart
Traditional university and college attendance methods suffer from severe vulnerabilities:
- ❌ Paper Sign-in Sheets: Easily signed by friends ("proxy attendance").
- ❌ Static QR Codes: Students photograph the QR code and send it over WhatsApp/Telegram to absent peers who scan from home.
- ❌ RFID / Smart Cards: Students hand their physical ID cards to friends to swipe for them.
- ❌ Manual Roll Calls: Consume 10–15 minutes of lecture time and are prone to human logging errors.
ClassGuard treats attendance verification as a zero-trust cryptographic challenge:
- Classroom TV Display Mode: Displays an animated, high-contrast dynamic QR code generated with session-specific HMAC-SHA256 signatures rotating every 12–30 seconds.
- Instant Web-Camera Scanning: Students scan the live TV screen from their mobile devices.
- 7-Layer Fraud Verification Pipeline: Validates student identity, active enrollment, single-use cryptographic nonces, time window, physical proximity, and detects multi-account device anomalies.
- Real-Time Faculty Command Center: Instructors watch their live attendance roster stream updates in real-time via Server-Sent Events (SSE).
- Competitive Gamified Leaderboard: Boosts student punctuality with ClassGuard Scores, consecutive streaks, and automatic 75% minimum semester threshold alerts.
┌────────────────────────────────────────┐
│ Classroom TV Display (/classroom)│
│ - Dynamic Rotating QR (HMAC-SHA256) │
│ - Live Verified Counter (Privacy-safe)│
└──────────────────┬─────────────────────┘
│ Realtime SSE Stream
▼
┌───────────────────────┐ ┌────────────────────────────────┐
│ Student Mobile PWA │ │ ClassGuard Core Backend Engine │
│ - Instant Camera Scan │────────────▶│ - Route Handlers / REST API │
│ - Device Fingerprint │ Attendance │ - 7-Layer Fraud & Risk Engine │
│ - Campus Proximity │ Verification│ - Cryptographic HMAC Validator │
└───────────────────────┘ Request │ - Prisma Relational ORM │
└────────────────┬───────────────┘
┌───────────────────────┐ │
│ Teacher Live Command │◀─────────────────────────────┘ Realtime Updates
│ - Live Student Roster │ (SSE Broadcast: Verified, Late, Suspicious)
│ - Manual Override/Log │
│ - CSV / Excel Export │
└───────────────────────┘
When a student scans the classroom display QR, the backend evaluates 7 independent layers to compute an authoritative Risk Score (0–100):
| Layer | Verification Signal | Mechanism & Defense |
|---|---|---|
| Layer 1 | Authentication & Enrollment | Validates signed JWT session and queries course enrollments to ensure the student is actively registered for the subject. |
| Layer 2 | Session State & Classroom Match | Verifies the session is currently ACTIVE (not paused or ended) and matches the physical classroom. |
| Layer 3 | Dynamic HMAC QR & Replay Prevention | Verifies HMAC-SHA256 signature generated with the session's secret seed. Enforces short expiration windows and burns nonces in database transactions to prevent replay attacks. |
| Layer 4 | Temporal Attendance Window | Validates server timestamp against teacher-configured attendance window (e.g. first 15 mins). Marks late if submitted during grace period. |
| Layer 5 | Classroom BLE Proximity (Configurable) | Evaluates classroom Bluetooth beacon UUID or cryptographic proximity signal to ensure in-room presence. |
| Layer 6 | Institutional Campus Network | Checks client IP against authorized classroom Wi-Fi subnets (e.g. 10.142.254.x). |
| Layer 7 | Device Anomaly & Multi-Account Detection | Detects when 2+ student accounts submit attendance from the same physical device within 15 minutes (friend proxying) or rapid device switching (+50 penalty). |
ClassGuard transforms mundane attendance into a motivating, competitive experience:
- Automatic Requirement Calculator: Under each subject, students receive real-time notifications:
- 🔴
⚠ Need 3 more classes to reach 75% threshold(Prevents exam debarment) - 🟢
✓ Safe — can miss 2 classes
- 🔴
- Configurable institutional thresholds (e.g., 75% warning, 85% healthy standing).
- Score Formula:
ClassGuard Score = (Attendance % × 70%) + (Streak Bonus × 30% max) - Achievement Badges:
- 🔥 On Fire: 3+ consecutive sessions attended
- ⭐ Perfect Attendance: 100% attendance rate
- ⚡ Punctual: 90%+ on-time arrival rate
- 📚 Scholar: 85%+ semester attendance
- Real-time podium ranking (🥇🥈🥉) viewable across the college.
| Role / View | Route | Description |
|---|---|---|
| 🏠 Home Portal | / |
Central launchpad directory with quick access to all modules |
| 🔑 Persona Login | /login |
1-click persona switcher (Abel, Adnan, Savan, Dr. Alan Turing, Admin) |
| 📱 Mobile Scanner | /student/scan |
Instant camera scanner with automatic token auto-detection |
| 🎓 Student Dashboard | /student |
Subject-wise breakdown, 75% attendance calculator & timetable |
| 🏆 Class Leaderboard | /leaderboard |
Real-time semester rankings, podium cards & achievement badges |
| 📜 Attendance History | /student/history |
Immutable log of all past attendance records & verification methods |
| 📅 Timetable | /student/timetable |
Weekly timetable schedule |
| 📺 Classroom Display TV | /classroom/lab-2-demo |
Fullscreen dynamic QR code (auto-rotates) + live counter |
| 👨🏫 Teacher Live Tracker | /teacher/session/[id] |
Real-time SSE command center with live roster & manual overrides |
| 📋 Teacher Dashboard | /teacher |
Start new attendance sessions, schedule classes & view past logs |
| ⚙️ Admin Control Panel | /admin |
College-wide analytics, audit trail logs, CSV imports & policies |
The application uses a normalized relational schema with full foreign keys, cascade safety, and optimized indexes:
User: Identity model (id, email, passwordHash, role, firstName, lastName, phone, isActive)StudentProfile: Student details (rollNumber, admissionYear, departmentId, currentSemester)TeacherProfile: Faculty details (employeeCode, departmentId, designation)Department: Academic departments (name, code, description)Subject: Courses (name, code, semester, credits, departmentId)Classroom: Physical rooms (name, building, roomNumber, capacity, beaconUuid, wifiSubnet)Enrollment: Student-course mappings (studentId, subjectId, academicYear, semester, status)AttendanceSession: Active/past class sessions (subjectId, teacherId, classroomId, status, secretSeed)AttendanceRecord: Attendance logs (sessionId, studentId, status, markedAt, riskScore, deviceFingerprint)QrToken: Single-use nonces burned upon scan for replay protection (sessionId, nonce, expiresAt)VerificationEvent: Diagnostic log storing passed rules, failed rules, and risk factorsManualOverrideAudit: Immutable audit log of faculty corrections (recordId, actorId, reason, timestamp)Device: Device fingerprint registry and trusted hardware associationSystemSetting: Configurable thresholds (HEALTHY_THRESHOLD,WARNING_THRESHOLD)
- Node.js v18+ (tested on v20 and v24)
- npm or yarn
git clone https://github.com/your-username/classguard.git
cd classguard
npm installcp .env.example .env# Push schema to SQLite database
npx prisma db push
# Seed demo students (Abel Bosco, Adnan Samwr, Savan Santhosh) & active Lab 2 session
node scripts/seed.jsOption A: Standard Development Mode
npm run dev
# Open http://localhost:3000Option B: Mobile Camera HTTPS Mode (Local Wi-Fi Testing)
node server.js
# Access from mobile phones on same Wi-Fi via https://<YOUR-LOCAL-IP>:3000|team no: 19| | Name | | Abel Bosco | | Adnan Sameer | | Savan Santhosh |
(You can also use the 1-click persona switcher on the /login page).
Run the automated cryptographic and fraud engine test suites:
npm run testIncludes tests for:
- ✅ HMAC-SHA256 dynamic token creation & signature validation
- ✅ Nonce expiration & single-use replay protection
- ✅ 7-layer verification risk scoring
- ✅ Multi-account proxy anomaly detection
- Framework: Next.js 14 (App Router, Server Actions, API Route Handlers)
- Language: TypeScript
- Database ORM: Prisma (SQLite default, ready for PostgreSQL / MySQL)
- Real-Time Engine: Server-Sent Events (SSE) via
EventEmitterbus - Styling: Tailwind CSS + Lucide Icons
- Cryptography:
node:cryptoHMAC-SHA256,joseJWTs,scrypthashing - QR Engine:
qrcode,html5-qrcode,BarcodeDetectorAPI - Testing: Vitest
This project is licensed under the MIT License — see the LICENSE file for details.
ClassGuard © 2024–2026. All rights reserved.