Skip to content
Hikki-devPublic

About

Book a bus seat, pay and show a ticket on your phone. One Flutter and Firebase app for passengers, conductors and admins, with live seat maps, QR tickets that board once, and Stripe payments.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

170 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BusLink

Checks Demo status Live demo Licence: MIT

Book a bus seat, pay, and show a ticket on your phone. One app for passengers, conductors and the people who run the buses.

A short tour: sign in, find a bus, choose a bus, pick seats, keep your ticket, the conductor checks it, and a second try is refused

One trip, from sign-in to boarding, in seven scenes. Open the live app and follow along.

A passenger finds a trip, picks seats on a live seat map, pays by card and gets a ticket with a QR code. The conductor scans it when the passenger boards, and the ticket can never be used twice. Admins plan the trips, watch the bookings and handle refunds.

You do not need to know how any of it works. Every screen uses big buttons and plain words, never shows a status by colour alone, and speaks three languages: English, Sinhala and Tamil.

On this page

What you get

One app, three people. Each one sees only the screens they need.

Who What they do
Passengers Search by route and date, pick seats on a live map, pay by card, keep tickets in My Trips, track the bus, ask for refunds, save favourite routes and book several dates at once
Conductors Scan a ticket or type its code, approve boarding, report a delay, change a trip's status and book walk-up passengers who have no app
Admins Add trips and timetables, browse bookings, review refunds, manage who is a conductor or admin, and read the revenue and late-departure reports

It also signs people in with email, Google or a phone number, sends push notifications and trip reminders, and works in light and dark themes. Tickets can be saved as a PDF.

What it is built with

Flutter logoFlutterOne app for phones, the web and desktop
Dart logoDartThe language Flutter is written in
Firebase logoFirebaseSign-in, the database (Firestore) and push messages
Google logoGoogle Sign-In"Continue with Google" on the sign-in page
Stripe logoStripeCard payments and refunds. Card details never touch BusLink
Vercel logoVercelHosts the web app and the two small payment functions

How everything fits together

A trip is one story with two halves. The passenger books, and later the conductor boards them.

The six steps from picking a seat to boarding the bus

Behind the screens, the app talks to Firebase for sign-in, data and push messages. Payments go to Stripe, from the phone directly or through two small functions on the web.

Diagram: the BusLink app talks to Firebase Authentication, Cloud Firestore and Cloud Messaging, to Vercel functions and a Cloud Function for payments, and those talk to Stripe

The full story, including every collection in the database, is in How everything fits. The walk through below follows the same steps.

Try it first

Open the live demo. It is the real app running on the web.

  • Press Sign Up to make a passenger account. New accounts are always passengers.
  • To pay, use Stripe's test card 4242 4242 4242 4242, any future date and any three digits. The demo is built with Stripe test keys. Never type a real card number into it.
  • Conductor and admin screens need an account that the owner has given that role. See Roles.

The Demo status badge at the top of this page turns red if the demo goes down. A small check runs every six hours (see Deploying). The Checks badge shows that the code and the docs pass their tests.

Or try every role on your own computer

You can run the whole app against a pretend Firebase on your own computer. Nothing is sent anywhere, and it comes with a customer, a conductor and an admin to sign in as. This is how every picture on this page was taken. The steps are in Try it on your computer.

The story, step by step

Every picture is the real app, taken from the running web version at twice the usual sharpness. Click a picture to see it full size. The wide picture is the computer view, and the tall ones below it are the phone view. The full walk through, with a little more detail for each screen, is in Getting started, and Every screen in one place lists them all.

Part 1: The passenger

It starts with someone who wants to get from Colombo to Kandy.

1. Sign in

The sign-in page: three language buttons, email and password boxes, Continue with Google and Log in with phone number, beside a photo of the Nine Arches Bridge

While the app opens, a short scene plays: a bus drives from Colombo through Kandy to Ella, and a line says what is happening (more in Starting up).

Choose English, Sinhala or Tamil with the three buttons at the top. Sign in with email, with Google, or with a phone number: you type your number, and a six-digit code arrives by text. Sign Up makes a new account. A new account is always a passenger. Nobody can pick a higher role for themselves.

On a phone: step 1. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

The sign-in page on a phone The sign-up page on a phone Phone login on a phone: enter a phone number and press Send Code Verify Phone on a phone: six empty boxes for the code, a Verify button and a Resend timer
1
The sign-in page
2
The sign-up page
3
Phone login
4
Verify Phone
Verify Phone with the six digits typed in
5
Verify Phone with the six digits typed in

2. Find a bus

The home page: a photo of the tea hills, the search card with Leaving from, Going to and Day of travel, and Your Favorites below

Choose where from, where to and the day, then press Search Buses. The little arrows swap the two cities. Tick Bulk booking to book several days in one go. Below the search, your favourite routes and your next trips are one tap away.

Booking several days at once. Tick Bulk booking, press the box that now says "days chosen", and tap each day you travel. Press Search Buses, choose a bus, and say how many people are travelling each day. A summary lists every date, the price per ticket and the total before you pay once. Each day gets its own ticket.

The search card with Bulk booking ticked and a box that says how many days are chosen

Choosing several days on a calendar: three days are selected

3. Your favourite routes

My favourites: a card for each saved route with a Book again button

Press the heart on any trip to keep the route. Book again fills in the search for you.

On a phone: steps 2 to 3. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

The home page on a phone, with the search card and the favourite routes The calendar on a phone Choosing how many people travel each day, with the total price The bulk booking summary: the dates, the price per ticket, the number of passengers and the total
1
The home page
2
The calendar
3
Choosing how many people travel each day
4
The bulk booking summary
My favourites on a phone
5
My favourites

4. Choose a bus

Search results: the filters on the left and one bus card with its times, price, seats left and a Book Now button

Each result is one card: who runs the bus, the times in plain 12-hour format, how long it takes and how many seats are left. The filters narrow the list by time of day and hide full buses. If something is wrong, the card says so in words.

A bus card with a warning that the bus is running 30 minutes late

A cancelled or full bus has a grey button that cannot be pressed, and pressing it explains why. Otherwise, press Book Now, or the red line under the bus name to see what is on it first.

5. About the bus

Bus details: departure, arrival and platform, what is on the bus, and the stops on the way

You see the times, the platform when the operator has set one, what is on the bus (air conditioning, WiFi) and every stop on the way. Press Choose seats to carry on.

6. Choose your seats

Choosing seats: the seat map with two seats chosen, and a summary with the total price

The seat map is live. Seats someone else has taken are grey with a cross. Your seats show a tick. You can choose up to six. Every seat can be read out by a screen reader ("Seat 9, selected"), and every seat can be chosen with one, too.

The seat map with two selected seats and several taken seats

When you continue, the seats are checked and reserved together in one step, so two people can never get the same seat. If someone was a moment faster, you are told and can choose again.

7. Pay

Payment: the booking summary on the right and a Proceed to Pay button

Check the summary, then press Proceed to Pay. On the phone a payment sheet opens. On the web you are taken to Stripe's secure page and sent back. Card details go straight to Stripe. If a payment fails or is cancelled, a card says what happened and offers the way on.

Payment states: processing, paid, cancelled and failed, each with a clear next step

On a phone: steps 4 to 7. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

Search results on a phone Bus details on a phone The seat map on a phone Two seats chosen on a phone, with the total at the bottom
1
Search results
2
Bus details
3
The seat map
4
Two seats chosen
Payment on a phone
5
Payment

8. Your ticket

The ticket: a QR code, a 4-character code, the trip, platform, seats and total, with Download PDF and Track bus buttons

You are shown Payment Confirmed and your ticket: a QR code for the conductor to scan, and a 4-character code to read out if scanning does not work. The ticket is also kept in My Trips, and can be saved as a PDF.

Straight after paying you land on Booking Confirmed, with the same QR code and code, a button to save the ticket as a PDF, one to send it by text message, and a link to keep the route in your favourites.

Booking Confirmed: the trip, the platform, the seats and a QR code with the code beside it

9. Follow the bus

Tracking: a map with the bus, a card saying how long is left and the next stop

Track bus opens a full-screen map. The bus shows as a pulsing dot, using the location the conductor's phone reports for that trip. One card says how long is left, worked out from the timetable plus any delay, and names the next stop. When there is no live location yet, it says so and uses the timetable. Within five minutes of arriving it turns into "Your bus is almost here", with a Show my ticket button.

10. My Trips

My tickets: a list of trips on the left, and the chosen ticket with its QR code on the right

Every ticket is one card with one big View ticket button. Before the first booking, a short message says what to do. The tabs sort them into Upcoming, Completed, Cancelled and Delayed. Track bus appears only when it is useful: the bus is on its way, is running late, or leaves within three hours. Refund is a small link, kept quiet on purpose so it is not pressed by accident.

A trip card with a View button, a Track bus button and a Refund link

On a phone: steps 8 to 10. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

The ticket on a phone Booking Confirmed on a phone Tracking on a phone My Trips on a phone
1
The ticket
2
Booking Confirmed (top of the page)
3
Tracking
4
My Trips
My Trips for someone with no tickets yet: a friendly message
5
My Trips for someone with no tickets yet

11. If plans change

Request a refund: the refund policy, a reason to choose, and how much you receive

Press Refund, read how much you get back (the earlier you cancel, the more), choose a reason and send it. A three-step line then shows where it is: Sent, In review, then Approved or Rejected.

The list of reasons: change of plans, personal emergency, the trip was delayed, cancelled by the operator, booking mistake, seat or bus problem, something else

Refund progress shown as Sent, In review and Decision, in three states

12. Your travel numbers

Travel Trends: how many trips are upcoming, arrived, delayed and cancelled, and the total spent

A friendly summary of your trips: how many are coming up, how many you have taken, what you have spent, your favourite destination and your busiest month.

13. Notifications

Notifications: a list of messages about a bus being on time, a delay and an approved refund

You hear about delays, cancellations, refunds and reminders. The bell shows how many are new. Press Mark all as read, or open the settings to choose what you want to hear about. The first time, the app asks if it may send notifications. Answer once: Allow is remembered for good, and Later waits a week.

14. Profile and settings

The profile page: name, email and a list of Account Settings, Notification Settings, Language, Dark Mode, My Favourites, Support and Send Feedback

Change your name and phone number, link your Google account, switch the language or dark mode, and tell us what you think with Send Feedback.

On a phone: steps 11 to 14. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

Request a refund on a phone Travel Trends on a phone Notifications on a phone Notification settings on a phone
1
Request a refund
2
Travel Trends (top of the page)
3
Notifications
4
Notification settings
The profile page on a phone Account settings on a phone The feedback form on a phone
5
The profile page
6
Account settings
7
The feedback form

15. Help and support

Help and support: common questions, a message form, emergency hotlines and a Call Support button

Answers to the questions people ask most, a message form that opens your email app, the emergency numbers for Sri Lanka, and one-tap buttons to call or email support.

That is the passenger's whole journey. More detail is in the Passenger guide. Now the other person in the story: the conductor, at the door of the bus.

On a phone: step 15. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

Help and support on a phone
1
Help and support (top of the page)

Part 2: The conductor

The passenger walks up with a phone. The conductor has about five seconds.

16. The conductor's home

The conductor's home: Scan Ticket with a box for a ticket code, and Find Trips

Two big jobs, one under the other: Scan Ticket (use the camera, or type the code and press Verify) and Find Trips. The app asks to use the phone's location so passengers can see where their bus is. Saying no is fine, and nothing else changes.

17. Check a ticket

A valid ticket: the passenger's name, their seats, the 4-character code and the seat map, with an Approve Boarding button

The answer is a big green "Ticket is valid" with the passenger's name, their seats, and the code to compare with the passenger's own screen. The same works for the long ticket number in the QR code and for the short code on the ticket. When they match, press Approve Boarding.

A valid ticket: passenger name, seats, the 4-character code and the seat map

Approving saves the time and the conductor on the ticket. If there is no signal, the app says so and keeps the card open. It never shows a boarding as saved when it was not.

18. Once only

After approving: back at the conductor's home with an empty code box, ready for the next passenger

A ticket boards once. If someone shows the same ticket again, even to a different conductor a moment later, the conductor sees this instead:

Already boarded: this ticket was already checked in, each ticket can board only once

Already boarded: this ticket was already checked in at 6:31 AM. Each ticket can board only once.

The check and the stamp happen together on the server, and the database rules enforce it too, so it holds even if someone tries to get around the app.

19. Find a trip and report a delay

Finding a trip: choose the origin, the destination and the day, then pick the trip

Choose where from, where to and the day, then pick the trip. If the bus is late, press the delay button and choose 15, 30, 45, 60 or 90 minutes, or type your own. Passengers with a ticket are told straight away, and their bus card says "Running 30 minutes late".

Open a trip to change its status with four big buttons: Departed, On Way, Arrived and Delayed. Issue Cash Ticket books a walk-up passenger who has no app.

Update Status: the trip, the Issue Cash Ticket button, and the Departed, On Way, Arrived and Delayed buttons

Report Delay dialog with quick minute choices

More in the Conductor guide. The last person in the story never sees a bus at all, but makes the whole thing possible.

On a phone: steps 16 to 19. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

The conductor's home on a phone A valid ticket on a phone Back at the conductor's home on a phone Already boarded on a phone
1
The conductor's home
2
A valid ticket
3
Back at the conductor's home
4
Already boarded
Find a trip on a phone The trips that match, on a phone Update Status on a phone
5
Find a trip
6
The trips that match
7
Update Status

Part 3: The admin

Before any passenger can book, someone has to have planned the trips. On a computer, the admin has a dark red menu down the left side. On a phone, the same pages are tiles, with a bar at the bottom.

20. Upcoming trips

Upcoming trips: a table of the next trips with the route, time, bus, seats taken, status and Edit, Seats and Delete buttons

The next 30 days of trips, with how many seats are taken and whether each is on time. Deleting a trip tells you how many seats are already booked before it asks you to confirm.

21. Add a trip

The Add New Trip form, step 1 of 3: choose or type the route

The trip form has three short steps: Route, then Schedule, then Fare and bus. You can fill in the platform (optional) so passengers know where to wait. Next checks only what you can see, and Back keeps what you typed. Nothing is saved until the last step.

The three-step indicator on the trip form

22. Routes and schedules

Route and schedule management: two tabs, and a table of routes with Edit and Delete

A route is the path. A schedule says which bus runs it and when, and can carry a default platform. Generate Trips makes the trips for the coming days from a schedule.

23. Bookings

Booking management: a search box, filters and a card for each booking with its status

Every booking has a status you can read at a glance. Each is an icon, a word and a colour together, so it works for everyone, including people who cannot tell red from green. A checked-in ticket shows Boarded.

Open a booking to see the trip, the passenger and what was paid.

Booking details: the route, date, bus and seats, the passenger, and the payment summary

Status chips: Confirmed, Boarded, Cancelled, Refund requested, Refunded, Pending, Approved, Rejected and Delayed

On a phone: steps 20 to 23. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

The admin home on a phone: tiles for Add New Trip, Add Route, Manage Routes, Bookings, Refunds, Analytics and App Feedback The Add New Trip form on a phone Routes on a phone: the table slides sideways Bookings on a phone
1
The admin home
2
The Add New Trip form
3
Routes
4
Bookings
Booking details on a phone
5
Booking details

24. Refunds

Refund management: three tabs, Pending, Approved and Rejected, and a card for each request with a Review button

Refund requests arrive in a list with three tabs, Pending, Approved and Rejected. Open one to see why the passenger asked and how much they get back. Approving one returns the money to the passenger's card through Stripe. Rejecting asks for a reason from a short list.

Refund details: the passenger, the trip price, the cancellation rule, the amount to refund and the reason, with Reject and Approve Refund buttons

25. Feedback and analytics

Customer feedback: a card for each message with the star rating and the comment

Read what passengers wrote and how many stars they gave. Analytics shows net revenue over time and the top routes, with a second tab for late departures.

Late departures: how many trips ran and what share left late

Analytics: net revenue for the last 30 days and today, a chart, and the top routes

26. Users and roles

User management: a search box and a table of people with their role and Edit and Delete buttons

A new account is a passenger. Only an admin can make someone a conductor or admin, here. The app notices a role change at once, with no sign-out. This is enforced by the database rules, not just the screens, and the rules have their own tests.

That closes the loop: the admin's trips are what the passenger searched for in step 2. More in the Admin guide.

On a phone: steps 24 to 26. Left to right, in order. Each caption names the screen. Click a picture to see it full size.

Refunds on a phone Refund details on a phone Feedback on a phone Analytics on a phone: net revenue and top routes
1
Refunds
2
Refund details
3
Feedback
4
Analytics
Users and roles on a phone
5
Users and roles

Every screen in one place

The design boards, one for each screen on a phone and on a computer, are listed in Every screen next to the picture of the finished screen. Start there to find a screen by name.

What keeps it safe

Four checks run on the server in a single step each, so they cannot be skipped by a slow phone or a clever one.

  • No double booking. Seats are checked and reserved together.
  • One boarding per ticket. The ticket is checked and stamped together, and the rules only let a conductor stamp it once, as themselves.
  • No paying without paying. Only the server marks a ticket confirmed, and only after it has asked Stripe whether that payment really happened, for the right amount, for exactly those bookings. The phone cannot say "I paid", and the price comes from the booking, not from the phone.
  • No self-promotion. Nobody can create or change their own role. A passenger cannot rewrite their own ticket's owner, price or seats, or mark it boarded.

These are proven by 49 database-rule cases and 18 payment-function cases that run on every change. The honest list of what still needs doing before real money is in Security.

Run it yourself

You need Flutter 3.38 or newer, a free Firebase project (with Email/Password, Google and Phone sign-in turned on, and a Firestore database), a Stripe account in test mode, and Node.js 18 or newer for the data scripts.

git clone https://github.com/Hikki-dev/Buslink.git
cd Buslink
flutter pub get

Then, once:

  1. Create lib/firebase_options.dart for your Firebase project (flutterfire configure).
  2. Create a .env file in the project folder. The build fails without it.
  3. Deploy the database rules, exactly as they are in the repository, and add some trips.
flutter run             # Android or iOS
flutter run -d chrome   # Web

Every step is explained, with the exact keys and commands, in Installing. Putting the web version online for free is in Deploying.

Tests

flutter analyze
flutter test
python3 tool/check_docs.py   # links and pictures in the docs

The same checks run on every pull request (the Checks badge above), together with 49 cases that test the database rules (and 18 for the payment functions) in the Firebase emulator.

The tests cover the parts that are easy to get wrong: the boarding rule, the arrival-time maths, the refund progress, the three-step trip form, the bus and ticket cards, and the status chips. See Testing, which also shows how to remake the pictures in this README.

Your privacy and safety

  • A passenger can only see their own tickets and profile.
  • Nobody can choose their own role. A new account is always a passenger.
  • Two people cannot book the same seat, and one ticket cannot board twice. Both are checked on the server, not just on the screen.
  • Card details go straight to Stripe. BusLink never sees or stores them.
  • The hidden debug login only exists in developer builds. It is not in the live app.

Some parts were built as coursework and need hardening before real money is involved. They are listed honestly in Security.

Help and more reading

If you want to Read
Follow the app from the first screen to a boarded ticket Getting started
Find a screen by its design name, with its picture Every screen
Try every role on your own computer, with test accounts Try it on your computer
Run your own copy Installing
Put it online Deploying
See what happens while it opens, and why it is fast Starting up
Learn each passenger screen Passenger guide
Learn the conductor screens Conductor guide
Learn the admin screens Admin guide
Understand how it works for people How everything fits
See what is stored and who can change it Data and rules
Read or change the code How it works
See the look and the rules it follows Design
Fix a problem Fixing problems
Find a quick answer Questions and answers
Set up Stripe Stripe setup
Run or write tests Testing
Report a security problem Security
Contribute a change Contributing
See what changed Changes

Legal and responsibility

  • BusLink is a portfolio and learning project. It is not a licensed ticketing service.
  • The code is released under the MIT licence. It is provided as it is, with no promises. You are responsible for how you use it, especially with real payments (see Security).
  • Use Stripe in test mode unless you have made the changes listed in Security first.
  • Brand names and logos (Flutter, Dart, Firebase, Google, Stripe and Vercel) belong to their owners and are used only to say what BusLink is built with.
  • Photos in the design mockups are from Wikimedia Commons, with credit to the photographers in the Design page.
  • Built by Yusuf (Hikki-dev).

About

Book a bus seat, pay and show a ticket on your phone. One Flutter and Firebase app for passengers, conductors and admins, with live seat maps, QR tickets that board once, and Stripe payments.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages