Project Showcase

Matatu Booking System — Kenya's Public Transport Platform

Kenya's premier matatu booking platform with real-time vehicle tracking, M-Pesa STK Push payments, 200+ routes, and WebSocket-powered live seat availability across the country.

9 views·5 min read·
- Passenger wait time
35 min → 8 min (77% reduction)
- Seat occupancy (return trips)
+22% improvement
- M-Pesa payment success rate
99.8%
- Booking-to-payment conversion
68%
dashabord for matatu booking.png

Tech Stack

🎸Django
Django REST Framework
Vue 3
Pinia
Tailwind CSS
Celery
Redis
🐘PostgreSQL
Safaricom Daraja API
WebSocket
Firebase Cloud Messaging

Why This Stack?

Django 4.2 + DRF provides a battle-tested backend for payment processing and route management.
Vue 3 with Composition API and Pinia enables a reactive, mobile-first booking interface with real-time seat updates.
Safaricom Daraja API (STK Push) integrates seamlessly with Django's request/response cycle for M-Pesa payments.
Redis + WebSockets handle concurrent seat reservations and live vehicle tracking.
Celery processes payment callbacks and sends SMS/email notifications asynchronously.
Tailwind CSS ensures a responsive experience for both mobile commuters and desktop fleet managers.

Gallery

dashabord for matatu booking.png
View Gallery

🚐 Matatu Booking System — Modern Public Transport Platform


🎯 Project Overview

The Matatu Booking System is a comprehensive transportation management platform that streamlines public transport booking, vehicle management, and payment processing across Kenya. The system enables commuters to search for available matatus, book seats in real-time, make secure M‑Pesa payments, and receive instant booking confirmations — transforming the traditionally informal matatu industry into a modern, data‑driven transport ecosystem.

Impact: 200+ active routes · 10,000+ M‑Pesa transactions · 99.8% payment verification rate · 40% reduction in passenger wait times


Core Features

🔍 Trip Search & Booking

  • Advanced search with origin, destination, date, departure/arrival time, and vehicle type filters
  • Amenity‑based filtering: Air Conditioning, WIFI, USB charging ports
  • Real‑time seat selection and reservation with conflict prevention
  • QR code generation for digital ticket verification at boarding
  • Instant booking confirmation via email and SMS notifications

💳 M‑Pesa Payment Integration

  • Seamless Safaricom Daraja API integration for M‑Pesa STK Push payments
  • Automated payment verification through M‑Pesa callback endpoints
  • Complete transaction history tracking and receipt generation
  • Support for both M‑Pesa and card payment methods

📱 Passenger Dashboard

  • Overview of total bookings, upcoming trips, completed trips, and total spend
  • Quick actions: Find Trip, My Bookings, Profile, Notifications
  • Upcoming trip management with cancellation and rescheduling capabilities
  • Recent activity feed and popular routes discovery

⚡ Real‑time Features

  • WebSocket‑powered live tracking of vehicle locations on map
  • Instant booking status updates and driver‑passenger communication channels
  • Firebase Cloud Messaging for push notifications and SMS reminders
  • Real‑time seat availability updates across concurrent users

⚙️ Settings & Notifications

  • Granular notification preferences: Email, Push, SMS, and Marketing emails
  • Security settings, privacy controls, and account danger zone
  • Profile management with verification workflows

🗺️ Route Coverage

CityRoutesMajor Termini Covered
Nairobi80+CBD, Westlands, Thika Road
Kisumu35+Bus Park, Kondele, Kibos
Mombasa40+Likoni, Nyali, Mtwapa
Nakuru25+Clock Tower, Lanet
Eldoret20+Town Centre, Annex

Plus: Dynamic route suggestions based on popularity and availability, with real‑time stage point updates.


🏆 Key Achievement

🎯 Successfully processed 10,000+ M‑Pesa transactions with 99.8% payment verification rate

Result: Reduced passenger wait times by 40% at major termini across Nairobi, Kisumu, Mombasa, Nakuru, and Eldoret.


🛠️ Tech Stack at a Glance

LayerTechnology
BackendDjango 4.2.7
APIDjango REST Framework 3.14.0
FrontendReact Native (Mobile)
DatabasePostgreSQL
CachingRedis 5.0.1
Task QueueCelery 5.3.4
Real‑timeDjango Channels + WebSockets
AuthJWT + django‑allauth
PaymentsM‑Pesa Daraja API
NotificationsFirebase Cloud Messaging
StorageAWS S3 (django‑storages)
MonitoringSentry SDK
DeploymentGunicorn + Whitenoise + Docker

🔗 How It All Works Together

ComponentRole
Django BackendHandles business logic, user authentication, and API endpoints
Django REST APIExposes endpoints for mobile app communication
WebSocketsEnables live seat updates and driver location streaming
Celery + RedisProcesses payment callbacks, email/SMS jobs, and QR generation
M‑Pesa DarajaExecutes STK Push and verifies payments asynchronously
Firebase FCMDelivers push notifications for trip reminders and updates
PostgreSQLStores user data, bookings, routes, and transaction history

📈 Performance Metrics

MetricValue
Daily Transactions200+
Payment Success Rate99.8%
Booking Confirmation Time< 2 seconds
WebSocket Latency< 100ms
Database Query Time< 50ms (cached)
Uptime99.95%
Active Users (Monthly)8,500+
Active Vehicles400+
Routes Covered200+

Project Gallery

dashabord for matatu booking.png
dashabord for matatu booking.png
faq for matatu book.png
faq for matatu book.png

Dependencies

Django==4.2
djangorestframework==3.14.0
celery==5.3.0
redis==5.0.0
psycopg2-binary==2.9.5
vue==3.3.0
pinia==2.1.0
tailwindcss==3.3.0
axios==1.4.0
firebase-admin==6.2.0

Case Study

Problem

Kenya's matatu (public minibus) transport sector serves over 70% of urban commuters but operates almost entirely informally. Commuters face: (1) unpredictable wait times at termini (20–60 minutes during peak hours), (2) no visibility into seat availability before arriving at the stage, (3) cash-only payments creating safety risks and inconvenience, (4) operators losing 15–20% of potential revenue from empty seats on return trips due to no advance booking mechanism, and (5) zero data on passenger demand patterns, making fleet deployment inefficient. Both commuters and operators needed a digital marketplace connecting real-time seat supply with demand, with integrated mobile money payments.

Solution

Designed a dual-interface platform: passenger mobile web app (Vue 3 + Tailwind CSS) and operator fleet management dashboard. Integrated Safaricom Daraja API for M-Pesa STK Push — passengers enter their phone number, receive a payment prompt on their device, and payment is verified via asynchronous callback in under 15 seconds. Implemented WebSocket connections for real-time: (1) seat availability updates across concurrent users booking the same vehicle, (2) vehicle GPS location tracking on passenger map view, and (3) instant booking confirmation push notifications via Firebase Cloud Messaging. Built advanced trip search with filters: origin/destination (200+ routes), departure time range, vehicle type (standard, luxury, shuttle), and amenities (WiFi, AC, USB). Celery processes: payment verification retries, automated SMS reminders 30 minutes before departure, and daily revenue reports for operators. Redis caches popular route search results (sub-100ms response) and manages booking locks to prevent double-booking.

Results

Pilot launched on 3 major Nairobi routes (CBD–Thika, CBD–Kitengela, CBD–Rongai) with 12 matatu operators. Onboarded 2,500+ passengers in the first 2 months. Average passenger wait time at termini dropped from 35 minutes to 8 minutes (pre-booking arrival aligned with departure). Operators reported 22% increase in seat occupancy on return trips (previously empty seats filled by advance bookings). M-Pesa payment success rate of 99.8% with automated reconciliation. Booking-to-payment conversion rate: 68%. Real-time tracking reduced "no-show" passenger rate from 15% to 4% (SMS reminders + live vehicle ETA). Operator dashboard provided first-ever demand analytics: peak hours, popular routes, and revenue per vehicle per day.

- Passenger no-show rate
15% → 4% (73% reduction)
- Routes covered
3 pilot routes, 200+ total routes mapped
- Active passengers (2 months)
2,500+
- Partner operators
12 matatu fleets
- Daily transactions
300+ bookings per day across pilot routes
- SMS reminder delivery rate
96%

Discussion

Join the conversation and share your feedback.

💬0Comments
👥0Contributors

No comments yet. Be the first to share your thoughts!

Leave a comment

💬 Join the Discussion

Share your thoughts with other developers.