A lightweight, high-performance Hostel Management System designed to run on resource-constrained devices (specifically tested on a Redmi 7A running LineageOS via Termux).
This project demonstrates how to turn an old smartphone into a dedicated mini-server with a structured relational database, automated maintenance, and a reverse-proxy setup.
The system follows a production-grade web stack adapted for mobile:
- Reverse Proxy: Nginx (Port 8080) for handling incoming traffic.
- WSGI Server: Gunicorn for managing Python worker processes.
- Backend Framework: Flask (Python) for API logic.
- Database: SQLite for efficient, file-based relational storage.
- Environment: Termux on Android/LineageOS.
- Student Module: Track personal and academic details.
- Room Allocation: Manage occupancy and link students to specific rooms.
- Mess Management: Record joining/leaving dates to optimize food preparation and reduce waste.
- Storage Optimization: Automated log rotation via
cronto maintain a small footprint on limited internal storage (5GB).
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/rooms |
Create a new room with capacity limits. |
GET |
/api/rooms/<id>/students |
Retrieve a list of all students assigned to a specific room. |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/students |
Register a student and assign them to a room/mess plan. |
PUT |
/api/students/<id> |
Update student records (Room changes, checkout dates). |
- Prepare Termux:
pkg update && pkg upgrade
pkg install python nginx cronie
pip install flask gunicorn
- Initialize Database:
python init_db.py
- Start Services:
nginx
gunicorn -w 2 -b 127.0.0.1:5000 app:app
- Automated Maintenance:
Add the following to your
crontab -eto clear logs older than 7 days at midnight:
0 0 * * * find /data/data/com.termux/files/home/ -name "*.log" -mtime +7 -delete
- Build a responsive HTML/CSS/JS frontend dashboard.
- Implement authentication for hostel wardens.
- Integrate Global Access via Cloudflare Tunnels or Tailscale.