How thamjianhao/auto-attendance-bot works
Project Type and Purpose
• This is a lightweight, monolithic web application built with Flask.
• Purpose: Automate the multi-step student class check-in process into a single click via
a. A server-rendered HTML form (templates/index.html)
b. A JSON-based API endpoint (/icheckin).
File Structure Analysis
• Top-level files:
• main.py – the single Flask app entry point, defines both the web UI route (GET /) and the API route (POST /icheckin).
• requirements.txt – Python dependencies (Flask, requests or similar).
• templates/index.html – Jinja2 template for the form UI.
• No separate static, frontend, or backend directories: this is a simple two-tier monolith (presentation + application logic).
• No database layer—user credentials and check-in codes are handled in memory and immediately forwarded to the external university system.
Key Architecture Details from README
• Two user interaction modes:
• Browser-driven via HTML form → internal Flask logic → external attendance portal
• Programmatic via JSON API → same internal logic → external portal
• Hosted on Render with an auto-sleep/wake cycle; no persistent storage.
• Security note: credentials are transient (in-memory only).
Main Components and Interactions
A. Clients
• Web Browser (renders HTML form)
• API Consumer (cURL, Postman, other scripts)
B. Flask Application Server (main.py)
1. Presentation Layer: routes and template rendering
2. Business Logic Layer:
• User authentication against external system
• Check-in code submission to external system
3. Response Layer:
• HTML response for browser
• JSON response for API clients
C. External University Attendance System
• The remote site where students normally log in and submit codes
D. Hosting Infrastructure (Render)
• HTTP load balancer/ingress
• Container or server running the Flask process
Architectural Patterns and Design Principles
• Monolithic two-tier architecture: Presentation + Application Logic in one codebase
• Single responsibility per route: one endpoint to render UI, one to handle API
• Stateless interactions: each check-in request is independent; no session persistence beyond the request
• “Anti-pattern” avoidance: no local credential storage, no long-running sessions