Skip to content

adharshio/phone_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hostel Management System (Mobile Backend)

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 Architecture

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.

πŸ› οΈ Features

  • 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 cron to maintain a small footprint on limited internal storage (5GB).

πŸ“‘ API Endpoints

Rooms

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.

Students & Mess

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).

πŸ”§ Installation & Setup

  1. Prepare Termux:
pkg update && pkg upgrade
pkg install python nginx cronie
pip install flask gunicorn
  1. Initialize Database:
python init_db.py
  1. Start Services:
nginx
gunicorn -w 2 -b 127.0.0.1:5000 app:app
  1. Automated Maintenance: Add the following to your crontab -e to clear logs older than 7 days at midnight:
0 0 * * * find /data/data/com.termux/files/home/ -name "*.log" -mtime +7 -delete

πŸ“ˆ Future Goals

  • Build a responsive HTML/CSS/JS frontend dashboard.
  • Implement authentication for hostel wardens.
  • Integrate Global Access via Cloudflare Tunnels or Tailscale.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages