Case file 04 / 06 — Mobility / Marketplace — In build
SafariGo
Intercity bus booking for Kenya: choose your exact seat, hold it while M-Pesa confirms, and carry a ticket that works with no signal.
Illustration02At a glance
- Type
- Mobility marketplace, in build
- Role
- Full-stack: API, mobile app, payments
- Stack
- Expo / React Native, NestJS, Prisma, PostgreSQL, Redis, Daraja
- Progress
- Build phases 1–9 complete; phase 10 (hardening) under way
What shipped
- Route search and operator comparison for trips like Nairobi → Mombasa.
- A visual seat map; a chosen seat is held in Redis with a time limit while payment completes.
- M-Pesa STK push through the Daraja API.
- A QR ticket stored on the device so it can be shown offline.
03The noise
Booking a long-distance bus in Kenya often means calling an operator or queueing at a stage, with no way to compare operators or know which seat you’ll get.
Payment is M-Pesa, and the phone is the only device most travellers carry. A ticket that needs data to load fails exactly where the bus goes.
04The signal
- 01
Hold the seat, not the money
Selecting a seat writes a short-lived hold to Redis; it becomes a booking only when the M-Pesa callback confirms payment.
Why — Two travellers must never pay for the same seat, and an abandoned payment must release the seat on its own.
- 02
The ticket lives on the phone
The QR ticket is stored locally after purchase and needs no network to display.
Why — Long stretches of the routes have weak or no signal, and that is exactly where a conductor asks for the ticket.
- 03
Modules mirror the business
The NestJS API is split into one module per domain — search, seats, bookings, payments — rather than one service layer.
Why — Each part can be tested and hardened on its own, which is what phase 10 is doing now.
05Showcase
ScreenshotSearch — where to, and when.
ScreenshotResults — operators side by side, priced in shillings.
ScreenshotSeat map — pick the exact seat you’ll sit in.
ScreenshotPayment — the seat is held, and the timer says for how long.
ScreenshotM-Pesa — the STK push lands on the traveller’s phone.
ScreenshotTicket — a QR code that works with no signal.
06Architecture
An Expo app talks to a modular NestJS API. Redis arbitrates seat holds; PostgreSQL stores what is confirmed; Daraja confirms payment.
Select a part of the system to see what it does and what it talks to.
Connections
- Expo app to NestJS APIsearch, select, pay
- NestJS API to Redis seat holdshold seat (TTL)
- NestJS API to M-Pesa DarajaSTK push
- M-Pesa Daraja to NestJS APIpayment callback
- NestJS API to PostgreSQL (Prisma)confirm booking
07Challenges
Challenge: Payment confirmation arrives asynchronously, sometimes late, sometimes never.
What I did: The seat stays held only for the hold’s TTL. A confirmed callback converts it to a booking; anything else lets it expire.
Challenge: Showing a ticket where there is no signal.
What I did: The ticket is generated and stored at purchase time, so showing it is a local read.
08Outcome
- Nine of ten build phases complete; hardening and release preparation are in progress.
Not yet documented
- Screens from a release build — the app is not yet released.
- Launch date and operator partners — not public.
09Sources
- Project BRIEF in the private repository