A secure, real-time college bus tracking and fleet operations web application built with Flask, MySQL, and vanilla JavaScript for Acropolis College, Indore.
- Interactive Transit Portals:
- Student Portal: Personalized route stops timeline, serving buses, bulletin alerts, live transit search, and custom route assignment.
- Driver Portal: Active trip dashboard, route schedule, bulletin board, manual GPS ping, and 10-second automatic geolocation broadcasting via Web Geolocation API.
- Administrator Portal: Fleet management, route & stop definitions with drag/order controls, broadcast announcement dispatch with expiry dates, and real-time security authentication audit logs.
- Dedicated Pages & Deep Linking:
- Buses Page (
#/buses): Grid view of all 40+ transit vehicles with assigned drivers, tap-to-call driver phone numbers, shift times, and inline interactive OpenStreetMap / Leaflet live tracking. - Stops & Routes Page (
#/stops): Accordion timeline of all 17 college routes with scheduled stop arrival times and serving bus chips.
- Buses Page (
- Enterprise-Grade Security:
- Password hashing via
werkzeug.security(scrypt/pbkdf2). - Strict role authorization (
/api/registerrestricted exclusively to students; admins created via seed, CLI, or admin portal). - Rate limiting on authentication attempts (maximum 5 failed attempts per email+IP per 10 minutes).
- Secure session cookies (
SESSION_COOKIE_HTTPONLY=True,SESSION_COOKIE_SAMESITE='Lax'). - GPS broadcast protection (only drivers assigned to the specific bus or admins can update coordinates; coordinates validated to float ranges).
- Complete XSS prevention (
escapeHtmlencoding across all dynamic UI components). - Generic server error responses (no stack trace or internal SQL leakage to client).
- Password hashing via
- Backend: Python 3.10+, Flask 3.1, Werkzeug 3.1
- Database: MySQL 8.0+ (InnoDB, lowercase tables, foreign keys with ON DELETE rules, indexing)
- Frontend: Semantic HTML5, Vanilla CSS3 (Dark Glassmorphism Theme), Modular Vanilla JavaScript
- Mapping: Leaflet.js with OpenStreetMap tiles
pj001/
├── app.py # Main Flask application and REST API endpoints
├── bustrackingdb.sql # Idempotent database schema and seed data (17 routes, 40 buses)
├── .env # Environment configuration (DB credentials, secret key)
├── .env.example # Example environment template
├── requirements.txt # Pinned Python package dependencies
├── test_app.py # Pytest test suite for security, auth, and API endpoints
├── launch.json # IDE debug configuration
├── Bus-Route.pdf # Source college route schedule (July 2015)
├── static/
│ ├── style.css # Dark glassmorphism stylesheet & responsive layout
│ └── app.js # Modular frontend client application
└── templates/
└── index.html # Main application single-page layout
- Python 3.10+
- MySQL 8.0+
Copy .env.example to .env and fill in your dedicated MySQL credentials:
cp .env.example .envExample .env:
FLASK_DEBUG=0
ALLOW_LAN=0
SECRET_KEY=generate_a_random_32_byte_hex_key_here
DB_HOST=localhost
DB_USER=routeiq_user
DB_PASSWORD=your_secure_password
DB_NAME=busmgRun MySQL as root to provision the database and application user:
CREATE DATABASE IF NOT EXISTS busmg;
CREATE USER IF NOT EXISTS 'routeiq_user'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON busmg.* TO 'routeiq_user'@'localhost';
FLUSH PRIVILEGES;Import the idempotent schema and full route seed data:
mysql -u routeiq_user -p busmg < bustrackingdb.sqlpip install -r requirements.txtYou can create an administrator securely using the Flask CLI command:
flask create-adminFollow the prompt to enter the administrator institutional email (e.g. admin@routeiq.edu) and a secure password (minimum 8 characters).
Start the Flask server:
python app.pyOr with Flask CLI:
flask run --host=127.0.0.1 --port=5000Open http://127.0.0.1:5000 in your browser.
- Admin:
admin@routeiq.edu/admin123 - Student:
student@routeiq.edu/password - Driver:
driver@routeiq.edu/password
Execute the automated pytest test suite covering authentication, admin registration prevention, GPS tracking authorization, notice expiry, and route/bus endpoints:
pytest test_app.py -v© 2026 RouteIQ · Acropolis College University Transit Systems.