A full-stack, hybrid (offline + online), biometric-enabled attendance management system built for educational institutions β runs from a USB pendrive locally and syncs to the cloud.
- Overview
- Architecture
- Key Features
- Tech Stack
- Database Schema
- Screenshots
- Getting Started
- Environment Variables
- Deployment (Render Cloud)
- Cloud Sync Engine
- API Reference
- Online Class Attendance
- ESP32 Smart Scanner
- Admin Analytics Dashboard
- Project Structure
- Security
- Troubleshooting
- License
A.R.I.S.E. is designed for institutions that need a portable, reliable attendance system. The core server runs from a USB pendrive on any computer in the classroom β no internet required for daily use. When internet is available, it automatically syncs to a cloud replica on Render.com, enabling:
- Offline classes β Biometric (ESP32 fingerprint) or manual attendance via the local server
- Online classes β OTP-based attendance via the cloud server with a shareable link
- Both records are merged on the cloud with zero data loss
| Role | What they do |
|---|---|
| Admin | Manages semesters, teachers, students, courses, enrollments. Views analytics dashboard |
| Teacher | Starts sessions, monitors attendance in real-time, exports reports to Excel |
| Student | Views personal attendance, course history, streak analytics, and leaderboard |
| ESP32 Scanner | Marks biometric attendance via fingerprint scanning during offline sessions |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β A.R.I.S.E. Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β LOCAL (USB Pendrive) CLOUD (Render.com) β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β Flask Server βββββ sync βββββΆβ Flask Server β β
β β SQLite DB β (auto 5m) β SQLite DB β β
β β Port 5000 β β Port 443 (HTTPS) β β
β ββββββββ¬ββββββββββββ ββββββββ¬ββββββββββββ β
β β β β
β ββββββββ΄ββββββββββββ ββββββββ΄ββββββββββββ β
β β ESP32 Scanner β β Online Attendance β β
β β (Fingerprint) β β (OTP via browser) β β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β
β ββββββββββββββββββββ β
β β Admin / Teacher / β β All web UIs work on both β
β β Student Portals β local and cloud servers β
β ββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The sync engine ensures no data loss between local and cloud:
- Local β Cloud push: Local DB is the master for admin data (students, courses, etc.)
- Online records preserved: Before replacing the cloud DB, all online session records are extracted, the DB is replaced, then online records are re-inserted with remapped IDs
- Result: Cloud always has both online + offline attendance records
- Full CRUD management for semesters, teachers, students, courses
- Course enrollment manager with drag-and-drop-style student assignment
- Enrollment roster view by semester
- Batch configuration (batch name, system settings)
- Analytics dashboard with 4 sub-tabs:
- Overview β 8 KPI cards + course-wise summary table
- Course Analytics β Per-student attendance breakdown with status badges
- Student Lookup β Cross-course attendance for any student
- Trends β Chart.js charts: daily, day-of-week, online vs offline, course comparison
- Cloud sync controls (manual push, status check)
- Start/end/extend attendance sessions for any assigned course
- Real-time attendance monitoring β see who's present live
- Manual override β mark individual students present/absent with reason
- Emergency bulk mark β mark all enrolled students present at once
- Session history with full session detail view
- Excel export β download per-session attendance reports (.xlsx)
- Course analytics β attendance trends and statistics per course
- Online class mode β start online sessions with OTP-based verification (cloud only)
- Device status monitoring for connected ESP32 scanners
- Personal dashboard with overall attendance percentage
- Per-course breakdown with detailed session-by-session history
- Critical alerts when attendance drops below threshold
- Attendance streaks and leaderboard
- Semester filter to view historical data
- Visual analytics with attendance trends
- Teacher starts online session on cloud server β gets a shareable link
- Students open link in browser β enter roll number + rotating OTP
- OTP refreshes every 30 seconds preventing screenshot sharing
- Teacher can also manually override online attendance
- Available only on cloud server β local server redirects to cloud
- Fingerprint-based biometric attendance marking
- Offline queue β stores marks locally when server is unreachable
- Auto-flush β sends queued records when connection restores
- Heartbeat β periodic health check with the server
- Session-aware β only marks during active sessions
- Automatic sync every 5 minutes (configurable)
- Smart merge β preserves online records, syncs offline records
- Full binary snapshot via SQLite backup API for consistency
- API key authentication between local and cloud
- Status monitoring via
/api/sync/status
| Layer | Technology |
|---|---|
| Backend | Python 3.10+, Flask 3.1, Gunicorn (production) |
| Database | SQLite 3 (portable, zero-config) |
| Authentication | JWT (PyJWT), bcrypt password hashing |
| Security | Flask-Limiter (rate limiting), Flask-CORS |
| Frontend | Vanilla HTML/CSS/JS (no frameworks β fast loading) |
| Charts | Chart.js 4.x (admin analytics + student analytics) |
| Excel Export | openpyxl |
| Scheduling | APScheduler (session auto-expiry, sync) |
| IoT | ESP32 + Adafruit Fingerprint sensor |
| Config | python-dotenv (.env files) |
| Cloud | Render.com (free tier compatible) |
βββββββββββββββ βββββββββββββββ ββββββββββββββββ
β admins β β semesters β β teachers β
βββββββββββββββ βββββββββββββββ ββββββββββββββββ
β id (PK) β β id (PK) β β id (PK) β
β username β β semester_nameβ β teacher_name β
β password β ββββββββ¬βββββββ β pin β
βββββββββββββββ β ββββββββ¬ββββββββ
β β
ββββββββ΄ββββββββββββββββββββ΄βββββββ
β courses β
βββββββββββββββββββββββββββββββββββ
β id (PK) β
β semester_id (FK β semesters) β
β teacher_id (FK β teachers) β
β course_name, course_code β
β default_duration_minutes β
ββββββββ¬ββββββββββββββββββββ¬βββββββ
β β
βββββββββββββ΄βββ ββββββββ΄βββββββββββ
β enrollments β β sessions β
ββββββββββββββββ βββββββββββββββββββ
β student_id β β id (PK) β
β course_id β β course_id (FK) β
β class_roll_idβ β start_time β
β (PK: s_id, β β end_time β
β c_id) β β is_active β
ββββββββ¬ββββββββ β session_type β
β β topic, otp_seed β
ββββββββ΄ββββββββ β session_token β
β students β ββββββββ¬ββββββββββββ
ββββββββββββββββ β
β id (PK) β βββββββββββββ΄βββββββββββββ
β student_name β β attendance_records β
β univ_roll_no β ββββββββββββββββββββββββββ
β enrollment_noβ β id (PK) β
β password β β session_id (FK) β
β email1,email2β β student_id (FK) β
ββββββββββββββββ β timestamp β
β override_method β
ββββββββββββββββ β manual_reason β
βsystem_settingsβ βββββββββββββββββββββββββββ
ββββββββββββββββ
β key (PK) β
β value β
ββββββββββββββββ
9 tables total: admins, semesters, teachers, students, courses, enrollments, sessions, attendance_records, system_settings
- Python 3.10 or higher
- pip (Python package manager)
- Git
# 1. Clone the repository
git clone https://github.com/JOYBOY-3/A.R.I.S.E.git
cd A.R.I.S.E
# 2. Create and activate virtual environment
python -m venv venv
# Windows
.\venv\Scripts\activate
# Linux/macOS
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Set up environment variables
cp .env.example .env
# Edit .env with your settings (SECRET_KEY is auto-generated on first run)
# 5. Initialize the database
python database_setup.py# Development
python server.py
# Production (with Gunicorn)
gunicorn wsgi:app --bind 0.0.0.0:5000The server starts at http://localhost:5000/
| Role | Login Page | Username/ID | Password/PIN |
|---|---|---|---|
| Admin | /admin-login |
admin |
admin |
| Teacher | / (main page) |
Course code dropdown | Teacher PIN |
| Student | /student |
University Roll No. | Student password |
β οΈ Change default credentials immediately after first login!
Copy .env.example to .env and configure:
# --- Security ---
SECRET_KEY=auto_generate_on_first_run # Auto-generates on first launch
# --- Server ---
FLASK_ENV=development # development | production
HOST=0.0.0.0
PORT=5000
# --- Database ---
DATABASE_PATH=attendance.db
# --- Admin ---
ADMIN_DEFAULT_PASSWORD=admin # Only used during database_setup.py
# --- Cloud Sync ---
CLOUD_SERVER_URL=https://your-app.onrender.com
SYNC_API_KEY=your-secret-sync-key
SYNC_INTERVAL_SECONDS=300 # Auto-sync every 5 minutes (0=manual)
# --- Cloud Detection (auto-set by Render) ---
# IS_CLOUD_SERVER=true # Set on cloud, not on local
# RENDER=true # Auto-detected on Render.com-
Push code to GitHub
-
Create a new Web Service on Render.com
-
Connect your GitHub repo
-
Configure:
- Build Command:
pip install -r requirements.txt - Start Command:
gunicorn wsgi:app(or use the Procfile) - Environment: Python 3
- Build Command:
-
Set environment variables on Render dashboard:
| Variable | Value |
|---|---|
SECRET_KEY |
(long random string) |
FLASK_ENV |
production |
SYNC_API_KEY |
(same key as local server) |
IS_CLOUD_SERVER |
true |
- On your local server's
.env, set:
CLOUD_SERVER_URL=https://your-app.onrender.com
SYNC_API_KEY=same-key-as-cloud| File | Purpose |
|---|---|
Procfile |
Tells Render how to start the app |
wsgi.py |
WSGI entry point for Gunicorn |
render.yaml |
Render infrastructure-as-code config |
requirements.txt |
Python dependencies |
The sync engine (sync_engine.py) handles bidirectional data consistency:
LOCAL (USB) CLOUD (Render)
βββββββββββββββββββ ββββββββββββββββββββββββ
β Offline classes β β 1. Extract online β
β only in local DB βββββ push βββββββββββΆβ records from DB β
β β (full binary) β β
β Master data: β β 2. Replace DB with β
β students,courses β β local snapshot β
β teachers, etc. β β β
βββββββββββββββββββ β 3. Re-insert online β
β records (remap IDs)β
β β
β Result: BOTH online β
β + offline records β
β
ββββββββββββββββββββββββ
- SQLite Backup API for consistent snapshots (no corruption risk)
- Smart merge β online sessions are preserved through extractβreplaceβre-insert
- ID remapping β re-inserted sessions get new auto-increment IDs, attendance FK updated
- Deduplication β checks
(course_id, start_time, session_type)before inserting - Auto-sync every 300 seconds (configurable)
- API key authentication on both ends
| Endpoint | Method | Purpose |
|---|---|---|
/api/sync/receive |
POST | Cloud receives DB snapshot from local |
/api/sync/push |
POST | Local triggers manual push to cloud |
/api/sync/status |
GET | Check sync status (node type, DB size, cloud reachability) |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/health |
β | Health check |
| GET | /api/sync/status |
β | Sync engine status |
| POST | /api/sync/push |
JWT | Trigger manual sync push |
| POST | /api/sync/receive |
API Key | Receive DB snapshot |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/admin/login |
Admin login (returns JWT) |
| GET/POST | /api/admin/config |
Get/set batch name and system config |
| GET/POST | /api/admin/semesters |
List/create semesters |
| PUT/DELETE | /api/admin/semesters/:id |
Update/delete semester |
| GET/POST | /api/admin/teachers |
List/create teachers |
| PUT/DELETE | /api/admin/teachers/:id |
Update/delete teacher |
| GET/POST | /api/admin/students |
List/create students |
| PUT/DELETE | /api/admin/students/:id |
Update/delete student |
| GET/POST | /api/admin/courses |
List/create courses |
| GET | /api/admin/courses-view |
Courses with teacher/semester names |
| GET/PUT/DELETE | /api/admin/courses/:id |
Get/update/delete course |
| GET/POST | /api/admin/enrollments/:course_id |
View/save course enrollments |
| GET | /api/admin/enrollment-roster/:semester_id |
Full enrollment roster |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/analytics/overview |
KPIs, course summary, at-risk count |
| GET | /api/admin/analytics/course/:id |
Per-student attendance for a course |
| GET | /api/admin/analytics/student/:id |
Cross-course attendance for a student |
| GET | /api/admin/analytics/trends |
Daily, weekly, online/offline trends |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/teacher/login |
Teacher login with PIN |
| GET | /api/teacher/course-codes |
List of available course codes |
| POST | /api/teacher/start-session |
Start offline attendance session |
| POST | /api/teacher/start-online-session |
Start online session (cloud only) |
| POST | /api/teacher/manual-override |
Mark/unmark individual student |
| POST | /api/teacher/emergency-bulk-mark |
Mark all students present |
| POST | /api/teacher/session/:id/end |
End active session |
| POST | /api/teacher/session/:id/extend |
Extend session duration |
| GET | /api/teacher/session/:id/status |
Get session status |
| GET | /api/teacher/session/:id/online-status |
Online session real-time status |
| GET | /api/teacher/report/:id |
Session attendance report |
| GET | /api/teacher/report/export/:id |
Download Excel report |
| GET | /api/teacher/analytics/:course_id |
Course analytics |
| GET | /api/teacher/history/:course_id |
Session history for course |
| GET | /api/teacher/session-detail/:id |
Detailed session view |
| POST | /api/teacher/update-attendance |
Update attendance records |
| GET | /api/teacher/validate-session/:course_id |
Check for active sessions |
| GET | /api/teacher/device-status |
ESP32 device status |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/student/login |
Student login |
| GET | /api/student/dashboard |
Personal attendance dashboard |
| GET | /api/student/semesters |
Available semesters |
| GET | /api/student/course/:course_id |
Per-course attendance detail |
| GET | /api/student/analytics |
Personal analytics |
| GET | /api/student/critical-alerts |
Low attendance alerts |
| GET | /api/student/leaderboard |
Attendance leaderboard |
| Method | Endpoint | Description |
|---|---|---|
| GET | /online/:token |
Online attendance page for students |
| GET | /api/online/session/:token/info |
Session info for online page |
| POST | /api/online/mark-attendance |
Mark attendance via OTP |
| GET | /api/online/session/:token/otp |
Get current OTP (teacher only) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/session-status |
Check if any session is active |
| POST | /api/mark-attendance-by-roll-id |
Mark attendance by class roll ID |
| POST | /api/bulk-mark-attendance |
Bulk mark from device queue |
| POST | /api/device/heartbeat |
Device health heartbeat |
Online attendance is available only on the cloud server. Here's the flow:
Teacher (Cloud) Student (Any Browser)
ββββββββββββββββ ββββββββββββββββββββββββ
β Start Online β β Open shared link β
β Session βββββ share URL βββΆβ /online/<token> β
β β β β
β See OTP on β β Enter roll number β
β dashboard β β Enter OTP β
β (refreshes β β (30-sec rotation) β
β every 30s) β β β
β β β β
Marked Present β
β Manual overrideβ ββββββββββββββββββββββββ
β available β
ββββββββββββββββ
- Token-based session URLs β unique per session
- Rotating OTP β changes every 30 seconds, prevents screenshot sharing
- One mark per student β duplicate submissions are rejected
- Manual override β teacher can mark/unmark any student
Located in FirmwareCodeOfEsp32/sketch_oct8a/.
- Install Arduino IDE or PlatformIO
- Install required libraries:
Adafruit Fingerprint Sensor LibraryArduinoJsonWiFi(built-in for ESP32)
- Configure Wi-Fi SSID/password and server IP in the firmware
- Upload to ESP32
- Teacher starts a session on the server
- ESP32 detects active session via
/api/session-status - Student places finger on scanner
- ESP32 reads fingerprint β maps to class roll ID
- POSTs to
/api/mark-attendance-by-roll-id - If server is unreachable β queues locally
- On reconnection β flushes queue via
/api/bulk-mark-attendance - Periodic heartbeat to
/api/device/heartbeat
The admin analytics section provides batch coordinators with deep insights:
- 8 KPI cards: Total Students, Courses, Sessions, Overall Attendance %, At-Risk Students, Online Sessions, This Week Activity, Avg per Session
- Course-wise summary table with color-coded attendance percentages
- Select any course β see every student's attendance with status badges (π’ Safe, π‘ Warning, π΄ Critical)
- Per-student present count, total sessions, percentage
- Session trend chart (Chart.js line chart)
- Search any student β see their attendance across all courses
- Recent absences list
- Overall attendance badge
- Daily Attendance β bar chart, last 30 days
- Day-of-Week Pattern β which days have highest attendance
- Online vs Offline β doughnut chart showing session type split
- Course Comparison β bar chart comparing sessions and attendance across courses
A.R.I.S.E/
βββ server.py # Main Flask application (all routes + logic)
βββ config.py # Configuration classes + .env loader
βββ database_setup.py # Database schema creation script
βββ sync_engine.py # Local β Cloud sync with smart merge
βββ analytics.py # Analytics computation module
βββ wsgi.py # WSGI entry point for Gunicorn
βββ backup_db.py # Database backup utility
βββ migrate_passwords.py # Password migration script (plaintext β bcrypt)
βββ attendance.db # SQLite database (created at runtime)
β
βββ templates/
β βββ admin-login.html # Admin login page
β βββ admin.html # Admin panel (5 tabs: Settings, Manage, View, Tools, Analytics)
β βββ teacher.html # Teacher dashboard
β βββ student.html # Student portal
β βββ online_attendance.html # Online attendance marking page
β
βββ static/
β βββ css/
β β βββ base.css # Shared styles, CSS variables, dark mode
β β βββ admin.css # Admin panel + analytics styles
β β βββ teacher.css # Teacher dashboard styles
β β βββ student.css # Student portal styles
β β βββ online.css # Online attendance page styles
β β βββ modal.css # Custom modal dialog styles
β β
β βββ js/
β β βββ admin.js # Admin panel logic (CRUD, tabs, enrollment)
β β βββ admin-analytics.js # Analytics dashboard (Chart.js, KPIs, tables)
β β βββ teacher.js # Teacher dashboard logic
β β βββ student.js # Student portal logic
β β βββ online.js # Online attendance logic (OTP, marking)
β β βββ modal.js # Custom modal component
β β
β βββ manifest.json # PWA manifest
β
βββ FirmwareCodeOfEsp32/ # ESP32 fingerprint scanner firmware
β βββ sketch_oct8a/
β
βββ .env # Environment variables (not in git)
βββ .env.example # Environment template
βββ .gitignore # Git ignore rules
βββ requirements.txt # Python dependencies (pinned versions)
βββ Procfile # Render/Heroku start command
βββ render.yaml # Render infrastructure config
βββ DEPLOYMENT.md # Deployment guide
βββ README.md # This file
| Feature | Implementation |
|---|---|
| Password hashing | bcrypt (adaptive cost factor) |
| Authentication | JWT tokens with expiration |
| Rate limiting | Flask-Limiter (5/min login, 100/min API) |
| CORS | Flask-CORS with configurable origins |
| API key sync | Shared secret between local and cloud for sync |
| Input validation | Server-side validation on all endpoints |
| SQL injection | Parameterized queries throughout |
| Session tokens | Cryptographically secure random tokens |
| OTP rotation | 30-second TOTP-style codes for online attendance |
| Auto-expiry | Sessions auto-expire after configured duration |
| Problem | Solution |
|---|---|
| "Server not reachable" | Ensure server.py is running, port 5000 is open |
| "Invalid credentials" | Default admin is admin/admin after database_setup.py |
| "Not enrolled" responses | Verify enrollments in Admin β Manage β Enrollments |
| Sync fails | Check CLOUD_SERVER_URL and SYNC_API_KEY match on both servers |
| Online attendance unavailable | Only works on cloud server (IS_CLOUD_SERVER=true) |
| ESP32 can't connect | Verify Wi-Fi config and server IP in firmware |
| Charts not loading | Clear browser cache or hard refresh (Ctrl+Shift+R) |
| Database locked | Stop all server processes, then restart |
Server logs are written to arise_server.log and stdout. Check logs for detailed error messages:
# View last 50 log lines
tail -50 arise_server.log
# Windows
Get-Content arise_server.log -Tail 50This project is developed for educational purposes.
Built with β€οΈ for classrooms that deserve better attendance systems.