Aziz Ur RahmanRésumé
← Work / Case study

Safar

A ride-hailing app for Peshawar, with rider and driver experiences in one Flutter codebase.

Role
Built it end to end
Company
TriTech Solutions
Timeline
3 months to launch
Platforms
Android · iOS · Web admin
Status
Live · safarapp.pk
Safar app screens
Context

The problem

Peshawar needed a local ride-hailing product that works for both riders and drivers. Riders name a fare, nearby drivers send offers, and the rider picks one. I built the rider app, the driver app, the API and the admin panel from one codebase, so booking, live tracking, chat, calling and driver management share the same foundations. For login, I sent phone OTPs through my own SMS Gateway instead of a paid third-party provider.

Architecture

How the pieces fit

Clients
  • Safar (rider app)Booking, fare offers, live map, chat, calling
  • Safar DriverRide requests, offers, navigation, documents
  • React admin panelOperations and management
Shared
  • safar_core (Flutter package)Login, maps, chat, calling, theme: used by both apps
API
  • Bun + Express APIRides, offers, dispatch, locations, notifications
Data
  • PostgreSQLRides, users, chat, ride paths
Services
  • SMS GatewayPhone OTP login, self-hosted
  • WebRTC + signalling workerPeer-to-peer voice calls
  • Push notificationsRide status, offers, incoming calls

Highlighted = the part that links this project to the other case study.

Scope

What I built

  • Rider and driver apps from one Flutter codebase, sharing a core package
  • Live maps, ride booking and fare offers from drivers
  • In-app chat and WebRTC voice calls
  • Push notifications
  • Phone OTP login through my SMS Gateway
  • Bun + Express API on PostgreSQL
  • React admin panel
  • Over-the-air patches for Dart-only fixes
Challenges

The hard parts

Two apps, one engineer

Safar started as one app with a rider mode and a driver mode. As the two drifted apart, I split them into two store apps, Safar and Safar Driver, inside one Flutter workspace. Login, maps, chat, calling and theming live in a shared package, so a fix lands in both apps while each one releases on its own. Dart-only fixes ship as over-the-air patches instead of waiting for store review.

Live location updates

At driving speed the phone reports a new position every second or so, far more than a map needs. The driver app sends at most one update every 8 seconds, plus a 30-second heartbeat when parked, because silence was making waiting drivers vanish from the rider’s map. The rider’s map refreshes every 5 seconds and shows nothing rather than a stale car. Low-accuracy fixes move the marker but stay out of the recorded route.

WebRTC on poor networks

Audio goes peer to peer (Opus, encrypted), with a TURN relay for networks that block direct connections. If the connection drops for 3 seconds, fails, or the phone switches networks, the caller restarts ICE. Three failed restarts in 30 seconds end the call cleanly. Losing the signalling connection doesn’t cut the audio: the call room waits 30 seconds while the app reconnects.

In-app calling

The API decides who may call whom and issues a short-lived ticket tied to the ride. A Cloudflare Worker with one Durable Object per ride relays the signalling and never touches the database. A phone that isn’t open is rung with a high-priority push, so neither side ever sees the other’s number. Live on Android, with iOS next.