BusManagementSystem
Full Stack Development Case Study
- Built
- 2023
- Role
- Sole developer
- Stack
- Django Β· Next.js Β· PostgreSQL
Fleet & ticketing platform Β· 2023
50+ buses, every route, seat and shift moved off paper
Django Β· Next.js Β· PostgreSQL
The context
Project Overview.
The client, a regional transport operator in Nepal, was managing a fleet of over 50 buses entirely on paper. Route assignments, ticket sales, driver rosters, and maintenance schedules were recorded in physical ledgers. This manual process led to frequent double-bookings, lost revenue through unaccounted ticket sales, and zero real-time visibility into fleet operations for management.
They required a complete digital transformation: a centralised system to manage the entire lifecycle of a bus trip, from assigning a driver and conductor to selling seats and tracking daily revenue. The system needed a robust backend to handle complex relational data (routes, schedules, seats, staff) and a fast, intuitive frontend that counter staff could use rapidly during peak booking hours.
Architecture & Stack
The Solution.
I architected a full-stack solution decoupling the frontend and backend to allow for future mobile app integration.
The Backend:Built with Django and Django REST Framework. Django's ORM was perfect for modeling the complex relationships between vehicles, routes (with multiple stops and varying pricing), schedules, and staff. PostgreSQL was chosen for data integrity, ensuring transactional safety during concurrent ticket bookings to prevent double-selling a seat.
The Frontend: Built with Next.js (React) and Tailwind CSS. The requirement for a highly responsive UI for counter staff dictated a single-page application feel, while Next.js provided the routing and structure needed for a large administrative dashboard.
Tech Stack
- Backend FrameworkDjango 4.x
- API LayerDjango REST Framework
- FrontendNext.js 13+ (React)
- DatabasePostgreSQL
- StylingTailwind CSS
- AuthenticationJWT (SimpleJWT)
Technical hurdles
Key Challenges & Solutions.
Challenge: Concurrency in Bookings
During festival seasons (Dashain/Tihar), multiple counter staff would attempt to book the same seat on the same bus simultaneously. Standard ORM saves would result in race conditions and double-booked seats.
Solution
Implemented PostgreSQL transaction blocks with `select_for_update()` in Django. This locked the specific seat row during the transaction, forcing concurrent requests to wait and subsequently fail gracefully if the seat was taken, guaranteeing data integrity.
Challenge: Dynamic Route Pricing
A single bus route (e.g., Kathmandu to Pokhara) might have 10 intermediate stops. Pricing isn't just A to B; it's A to C, B to C, etc., creating a matrix of prices that needed to be easily manageable by admins.
Solution
Designed a graph-based schema for routes. Instead of hardcoding all permutations, the system stored base fares between adjacent stops. The backend dynamically calculated fares between any two points on the route using graph traversal, significantly simplifying data entry.
Business results
The Outcome.
The deployment of the Bus Management System completely transformed the client's operations within the first month. Paper ledgers were entirely phased out. Management gained access to a real-time dashboard showing daily revenue, seat occupancy rates, and vehicle utilisation.
60%
Reduction in Booking Errors
100%
Digitised Ledger
Zero
Double-Booked Seats
Next steps
Want Something Like This.
The service behind it
Concurrent-safe booking, a graph-based fare model and a dashboard non-technical counter staff use all day β a Django REST backend doing real operational work, not a CRUD demo.
Django backend developmentβHow the work runs
Written scope and a fixed quote before anything starts, a running demo every two weeks, and three to five hours of daily overlap with the UK, Europe, the US and Australia.
Who built it
Every project on this site was built by one person, working directly with the client β no account manager in between, and no team you never meet.
Related work
Other Case Studies.
2023 Β· Flutter
GymTaar β Fitness Platform
Live on App Store & Play Store Β· 500+ active users
Read case studyβ2023 Β· Next.js
BabalCloud
Fully automated VM provisioning Β· Complex Stripe billing
Read case studyβ2022 Β· Python
Fake News Detection (AI)
94% classification accuracy Β· REST API deployed
Read case studyβ