Back to projects
iOS & Android API

Delivery Rider App — Mobile API

Order Assignment, Multi-Stop Runs, Cash on Delivery & Proof Photos

Node.jsExpressMySQLJWTFCMS3 Uploads
Platforms
iOS + Android
Auth
JWTaccess + refresh
Real-time
FCM push
Payments
COD + prepaid
iOS & Android · REST APIUI concept
Delivery Rider App — Mobile API — screenshot

API for last-mile delivery riders. Riders receive assigned orders, start a multi-stop run, navigate to each customer, collect cash where needed, and close each order with a photo. Cash collected is reconciled at the end of the day.

Architecture & System Design

A Node.js and Express API. Orders are grouped into runs per rider. Each delivery updates the order status and, for cash orders, records the amount collected in a rider cash ledger. End-of-day reconciliation compares the ledger against cash handed in at the hub.

Request Flow
Order Placed
Assignment to Rider
Run Started
Delivery & COD
Proof Photo
Cash Reconciliation
  • Runs group several orders so riders work through stops in order
  • Cash-on-delivery tracked in a per-rider ledger for clean daily reconciliation
  • Failed deliveries captured with a reason and rescheduled automatically
  • Push notifications for new assignments and customer updates

Engineering Challenges

Cash Accountability

Problem

With many cash orders per day, it was hard to know exactly how much cash each rider should hand in.

Solution

Recorded every COD collection against the rider and order in a ledger, and built a reconciliation endpoint for hub staff.

Result

Each rider's expected cash is known at any moment, and differences are visible immediately.

Failed Delivery Handling

Problem

Customers not home or unreachable left orders stuck in an 'out for delivery' state.

Solution

Added a failed-attempt flow with mandatory reason and photo, which returns the order to the queue for the next run.

Result

No orders get stuck, and support can see exactly why a delivery didn't happen.

Core Features

Order Assignment

New orders assigned to riders with push alerts and full order details.

Clean Code

completeDelivery.js
1// Mark delivered and record COD in the rider's cash ledger atomically
2"color:#c792ea">export "color:#c792ea">async "color:#c792ea">function completeDelivery(db, { order, riderId, cashCollected }) {
3 "color:#c792ea">await db.transaction("color:#c792ea">async (trx) => {
4 "color:#c792ea">await trx("orders")
5 .where({ id: order.id })
6 .update({ status: "delivered", delivered_at: trx.fn.now() });
7
8 "color:#c792ea">if (order.payment_method === "cod") {
9 "color:#c792ea">await trx("rider_cash_ledger").insert({
10 rider_id: riderId,
11 order_id: order.id,
12 amount: cashCollected ?? order.total,
13 });
14 }
15 });
16
17 "color:#c792ea">await push.toCustomer(order.customer_id, "Your order has been delivered");
18}

Want something like this for your business?

I design and build full stack products end to end. Tell me about your idea and I'll get back to you with a plan.