Back to Projects
// full-stack development case study
Trekking Management App
A secure, transaction-safe operations platform modeled on realistic business logic—managing the lifecycle of trekking expeditions across three separate user roles.
Project Context
Academic Project
IIT Madras (Online)
IIT Madras (Online)
Course
Modern Application Development - 1
Tech Stack
Python, Flask, SQLAlchemy, SQLite, Bootstrap 5
Overview & Business Rules
The Trekking Management App is built around a strict, enforceable set of operational rules rather than just basic CRUD dashboards. It maps the complete, secure lifecycle of a trekking business, separating workspaces for administrators, guides, and trekkers.
Key logical rules integrated at the core database level ensure that:
- Available slots can never drop below zero or exceed a trek's maximum capacity.
- Guides (Staff profiles) are locked from reassignment once their assigned trek goes underway.
- Cancellations are preserved non-destructively for historic ledger logs.
Technical Deep Dive
Architecture & Codebase Stats
- Application Factory Pattern: Built using
create_app()with 5 independently registered Blueprints (auth,main,admin,staff,user) for a clean separation of concerns. - Relational DB Design: 4 core models (
User,StaffProfile(1:1),Trek,Booking) with proper foreign keys, relationships, and cascade deletes. - Custom Decorator-Based RBAC:
admin_required,staff_required, anduser_requireddecorators gate authentication status, roles, account status, and staff approval status. - Auto-Seeding & Reset:
seed.pygenerates realistic demo data (24 users, 10 staff, 18 treks across 7 states, proportional bookings) andreset.pywipes data while preserving the main Admin account. - Substantial Codebase: ~2,800 lines of Python and ~4,250 lines of Jinja2/HTML templates across 27 views.
Core Engineering Highlights
- Transactional Slot Integrity: Bookings and cancellations occur within SQL transactions that update trek slot counts in real-time, preventing overbooking.
- Trek Lifecycle State Machine: Tracks 7 states (Pending → Approved → Bookings Open → Bookings Closed → Ongoing → Completed, with a Cancelled branch) and locks staff reassignment once underway.
- Layered Staff Approvals: Differentiates account status (Active/Blacklisted) from approval state (Pending/Approved/Rejected) to ensure only authorized guides can access dashboard tasks.
- Cascading Rules on Blacklist: Blacklisting a staff member instantly flags their approval status as Rejected and auto-unassigns them from all non-terminal treks.
- Non-Destructive Ledger: Bookings are never hard-deleted; cancellation states are preserved for historic accounting and audit logs.
- Guarded Deletion: Treks with any booking history are locked from deletion entirely to protect transactional audit trails.
- Multi-Field Relational Search: Platform-wide search/filter using SQLAlchemy
ilikeandor_query operators, correctly scoped by user role.
Role-Based Workspaces
Admin Portal
- System Overview Dashboard: Monitor real-time metrics including total treks, registered users, staff guides, and total bookings with quick links.
- Trek Inventory CRUD: Create, view, search, edit, or delete trekking routes. Guide assignments are locked once treks are underway.
- Guide & Staff Gateway: Manage guide application workflows, approve pending profiles, and execute blacklist actions.
- User & Booking Audits: View registered trekkers and access a non-destructive ledger recording every transaction and payment state.
Staff (Guide) Dashboard
- Trek Operations: View assigned upcoming expeditions and monitor live participant list counts.
- Participant Roster: Log payment receipts, request participant cancellations, and view traveler health/experience notes.
- Row-Level Access Controls: Guides can only access and modify expeditions assigned to their specific profiles.
User (Trekker) Workspace
- Expedition Search: Search and filter available treks by location, difficulty level, cost, and date range.
- Transaction-Safe Booking: Book spots in real-time with automatic double-booking blocks and maximum slot capacity guards.
- Trip Ledgers: Monitor upcoming itineraries, download receipt statements, and process trip cancellations.
// skills showcased
Key Technologies & Engineering Skills
Python
Flask (App Factory)
SQLAlchemy ORM
RBAC (Role-Based Security)
SQL Transactions
State Machines
Jinja2 Templating
Bootstrap 5 & Icons
Relational DB Design (SQLite)