Bus Ticketing System
PR301 SEMESTER PROJECT
Taken up as part of the PR301 semester project at IIITDM Jabalpur, the project was built with the intention to make an attempt to digitize the current system used for transit to and from the campus, the result was a system that provides real time updates about seat vacancy, a convenient wallet system, and security features like single device sign in. To prevent hogging a sophosticated QR based system was implemented to unqiuely identify user and validate tickets.
Node.js
Express.js
MongoDB
Redis
Web Sockets
Server Sent Events
DETAILS
The project was inspired by the will to solve the current situation of bus ticketing for IIITDM Jabalpur. The campus operates two buses, which make several trips to and from the city, but there is no way to know the status of tickets other than calling and checking. There is also the issue of maintaining cash as the current method does not allow online payment. Sometimes students lose the physical ticket they bought and thus have to re-purchase and the bus conductor has no way of knowing whether the seat for that ticket will be occupied or left vacant.
To solve all these problems, my friends and I decided to digitize the system, we arrived at a solution with a student app, a conductor app, and a backend server to facilitate all ticketing-related operations. I took up backend development of the project, and during the process, I was faced with many problems, solving them taught me a lot about system design, backend development, and working in a team.
The project features the following:
- Real-time seat updates: The system implements Server-Sent-Events to update seat details in real-time, as soon as a ticket is purchased all other users that have their apps open are updated about the consumed seat.
- Live ticket booking: Users are allowed to book tickets on the go at their convenience, the consistency of this booking is ensured using MongoDB ACID-compliant transactions
- Queueing system: An innovative solution to solve the issue of heavy traffic during rush hours and allow preferential booking on a truly first come first serve basis. The system allows you to arrange buses in the order of your preference and join a queue of ticket requests. At a specified time during the day, the queue gets processed and you get a ticket based on the current availability and preference.
- Socket Architecture: The system also uses Socket.io to implement a socket event architecture in case more real-time update-based features are to be added eg. a live feed, chat system, etc.
- Time-bound operations: The server has a system in place that allows operations based on current time, eg. queueing is allowed only in a certain time window after which live ticketing is allowed, while the server is processing queues, it does not allow other operations to ensure a low server load.
- Kill-switch: The system features a kill switch to remotely shut down server routes in case of a failure or in case of need of maintenance.
- Ingenious wallet system: The system features an encryption-based wallet system to allow transactions that can be executed directly and reliably without having to confirm with a third party.
- Advanced ticket validation: The ticket validation system is designed to provide a smooth experience and avoid any kind of hogging and re-sell of tickets. The system implements a session code-based system that is stored in a Redis cache store to ensure low latency, every time a ticket is validated the session code gets updated automatically thus ensuring any user with an outdated session code can be detected and thus the legitimacy of the ticket can be verified by requesting a fresh QR generation.
- Single device sign-in: The system implements a single device sign-in so a user cannot open multiple sessions to spam the server with automated requests.