Delivered remotely for a business based in Copenhagen, Denmark. Names withheld by agreement.
Project Overview
Fuel retail is evolving beyond self-service pumps toward high-convenience concierge care—both on station forecourts and for parked commuter or fleet vehicles in designated service zones. Yet orchestrating physical fuel handling requires far tighter discipline than parcel delivery: an attendant cannot risk pumping petrol into a diesel tank, losing GPS lock inside a parking structure, or miscalculating metered liters against pre-authorized card holds.
We built an on-demand fuel service and station attendant platform tailored for Danish urban mobility operations. Native Swift and SwiftUI apps on iOS alongside Kotlin apps on Android serve both motorists and station attendants, connected to a Laravel and MySQL transactional core, Blade station-management consoles, and Firebase real-time dispatch telemetry.
Forecourt Dispatch & Pump-Side Constraints
Digitizing attended fueling and add-on vehicle care introduces stringent physical and operational constraints:
- Misfuel liability: Verbal bay instructions or hurried manual entry risk mismatching fuel grades against customer vehicle tanks.
- Variable settlement amounts: Tank capacity limits mean the final dispensed liter volume rarely matches the driver's initial order estimate, requiring clean pre-authorization and partial-capture flows.
- Outdoor and gloved usability: Station attendants operating in rain, cold wind, and busy forecourts need high-contrast, single-handed controls rather than cluttered web views.
- Race conditions in job claiming: Dispatching urgent requests to multiple nearby attendants without strict locking produces awkward double-arrivals and confused drivers.
Architectural Strategy
We anchored the system around a strict server-enforced state machine in Laravel and MySQL paired with Firebase as a low-latency dispatch signal bus. Every order advances sequentially through validated states—requested, assigned, arrived, safety-verified, fueling, completed—with database transactions guarding ownership claims and financial capture.
On mobile, native SwiftUI and Kotlin interfaces optimize for speed and clarity: drivers pin their vehicle location, pick fuel grade and optional services (such as washer fluid top-ups or tire checks), and watch arrival progress live; attendants receive audible Firebase job alerts, scan vehicle/pump tags, record exact metered liters, and issue itemized receipts. Station supervisors oversee pricing, shift rosters, and safety audits through Blade administrative consoles.
Core Capabilities
- Vehicle-Profile Grade Locking: Motorists register license plates and required fuel types once; attendants verify the physical cap or bay code before unlocking the fueling step.
- Real-Time Attendant Dispatch & Routing: Geofenced matching routes requests to available forecourt or mobile attendants with live ETA updates streamed via Firebase.
- Metered Finalization & Dynamic Pricing: Station managers adjust per-grade pricing by zone or site in Blade, while orders settle automatically against exact metered liters delivered.
- Safety & Environmental Checklists: Mandatory pre-dispense confirmations—grounding, ignition off, no leaks, spill-kit ready—attach timestamped audit records to every job.
- Shift & Fleet Reconciliation: Daily summaries reconcile dispensed volumes by fuel grade, attendant shift, and station bay against payment gateway settlements.
Technical Architecture
Motorists submit fuel requests from SwiftUI or Kotlin clients to Laravel APIs, which validate station coverage, lock current unit pricing, and authorize payment holds inside MySQL. Laravel pushes dispatch payloads through Firebase Cloud Messaging and Realtime Database to eligible online attendants. When an attendant taps Accept, Laravel acquires a pessimistic MySQL lock to finalize assignment, while the attendant's native device streams adaptive GPS coordinates back to Firebase for the customer map. Upon delivery completion, metered volume triggers exact capture and asynchronous PDF/email receipt jobs.
Flow: Motorist Request (SwiftUI / Kotlin) → Laravel Pre-Auth & Pricing Lock (MySQL) → Firebase Attendant Broadcast → Atomic Claim Lock → Native Safety Check & Metered Settlement → Blade Shift Reconciliation
Separating live map telemetry (Firebase) from monetary and safety state transitions (Laravel + MySQL) keeps dispatch fluid while preserving auditable financial accuracy.
Technology Stack
| Category | Technology detail |
|---|---|
| Dispatch & Billing API | Laravel (PHP 8.x order state machine, dynamic fuel pricing, payment capture) |
| iOS Customer & Attendant Apps | Swift & SwiftUI native interfaces for one-tap requests, live tracking, and pump workflows |
| Android Native Apps | Kotlin applications with background foreground-service GPS and NFC/QR bay scanning |
| Operations & Station Portal | Laravel Blade dashboards for forecourt shift control, price boards, and reconciliation |
| Transactional Database | MySQL for orders, vehicle profiles, fuel grades, attendant shifts, and settlement ledgers |
| Real-Time Telemetry | Firebase Realtime Database & FCM for live attendant coordinates and instant job offers |
| Safety & Audit Logging | Immutable MySQL event logs capturing pre-fueling safety checks and metered receipts |
| Background Job Queues | Laravel Queues for receipt generation, station payout batches, and SLA escalation alerts |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Maintaining responsive live tracking without excessive mobile battery drain | Tuned native Kotlin foreground services and Swift CoreLocation policies to throttle GPS intervals by order stage, trading continuous idle tracking for full-shift battery endurance. |
| Handling partial tank fills gracefully during payment settlement | Replaced fixed-amount charges with payment pre-authorization followed by server-side exact capture in Laravel, adding mild gateway complexity to eliminate manual refund workflows. |
| Delivering clear attendant UIs across bright sunlight and winter conditions | Designed high-contrast SwiftUI and Kotlin Jetpack screens with oversized primary actions and offline retry buffers for underground parking bays, trading extra native UI maintenance for superior field ergonomics. |
| Preventing stale fuel prices between browse and checkout | Bound every checkout quote to a short-lived server price snapshot ID in MySQL, ensuring transparent user confirmation if a station updates pump prices mid-session. |
Security & Reliability
Handling fuel and unattended vehicle access demands rigorous accountability. Attendant onboarding validates safety certifications and station assignments in Laravel before issuing device-bound credentials. Firebase security rules restrict live coordinate streams solely to the assigned motorist and operations supervisors for the duration of an active order, expiring read access automatically once fueling finishes.
Every API transition enforces idempotency keys so flaky forecourt Wi-Fi or garage dead zones never trigger duplicate charges when an attendant taps Complete twice. Critical exceptions—such as prolonged orders stuck in fueling status or mismatched meter tolerances—raise immediate alerts in the Blade operations console.
Performance & Scale
Commuter rush hours and weekend travel peaks create concentrated regional demand spikes around major stations and parking hubs. Stateless Laravel containers scale behind load balancers, while MySQL handles high-concurrency order claims using narrow indexed queries rather than long-running table locks.
Background queue workers offload receipt rendering, fleet invoicing exports, and nightly fuel-volume reconciliations, keeping customer checkout and attendant state transitions consistently snappy. Firebase pushes delta updates rather than full order objects, keeping mobile bandwidth minimal even inside congested urban cells.
Operational Outcomes
Unifying customer requests, native attendant safety workflows, and station accounting under one architecture elevated service reliability across every forecourt touchpoint:
- Eliminated misfuel guesswork: Mandatory vehicle-profile matching and QR/bay verification guard every dispense before fuel flows.
- Transparent metered billing: Automated pre-authorization and exact-liter capture keep pricing fair for drivers while simplifying station accounting.
- Coordinated attendant utilization: Real-time Firebase dispatch and atomic MySQL job locking eliminate idle overlap across pump bays and mobile service zones.
- Complete regulatory auditability: Timestamped safety checklists, attendant identities, and reconciled fuel-grade logs remain immediately accessible inside Blade operational reports.