# NFC Attendance System (TapBox) ## Goal Build a demo-ready NFC attendance system using: - PHP + JSON backend - ESP32 + NFC + OLED hardware - Lightweight HTML frontend Supports school, office, construction, and college attendance workflows in one system. --- ## Small Architecture ### Frontend (UI Pages) - index.html (landing page) - dashboard.html (mode control + quick tap + live snapshot) - users.html (user management) - analytics.html (filters + reports) ### Backend (API Endpoints) - api/get_mode.php - api/set_mode.php - api/attend.php - api/export.php - api/users.php ### Core Services and Data - get_mode.php, set_mode.php, attend.php, export.php - users.json (registered users) - attendance.json (attendance events) - mode.json (active mode) ### Request Flow 1. Frontend page sends request to /api/* 2. API endpoint executes backend PHP logic 3. Backend reads/writes JSON files 4. API returns response to frontend and/or ESP32 --- ## Attendance Logic ### School Mode - Always mark Present ### Office Mode - First scan -> Check-In - Second scan -> Check-Out ### Construction Mode - One entry per day ### College Mode - One entry per day --- ## Input Methods ### 1. Phone/Web Tap - Open endpoint: api/attend.php?uid=USER_ID ### 2. ESP32 Device - Read NFC UID - Send HTTP request to api/attend.php --- ## API Response Format SUCCESS|Name|Status ERROR|Message --- ## Demo Flow 1. Open dashboard.html 2. Select active mode 3. Tap NFC card (or quick tap test) 4. See live status on web and OLED 5. Review analytics and export CSV --- ## Constraints - No database (JSON only) - No authentication - No framework dependency - Keep setup simple for demos