Logistics & Fleet Tracking App — Mobile API
Shipment Timelines, Dispatch, Fleet Status & Proof of Delivery
API for a logistics company's mobile apps. Operations staff dispatch shipments to vehicles, drivers update shipment status from the road, customers follow a tracking timeline, and every delivery is closed with a photo and signature as proof of delivery.
Architecture & System Design
A Node.js and Express API. Shipments move through a defined set of statuses, and every change is stored as an event with time and location. The tracking timeline is built from those events. Proof-of-delivery files are uploaded directly to object storage using pre-signed URLs so large images don't pass through the API servers.
- Event-based shipment history gives a full audit trail for every parcel
- Pre-signed uploads keep large proof-of-delivery photos off the API servers
- Fleet view shows each vehicle's status, current route and load
- Customers notified automatically at key milestones
Engineering Challenges
Updates from Poor Coverage Areas
Drivers on highways often lose signal, so status updates arrive late or out of order.
Accepted updates with the device's original timestamp and an idempotency key, and ordered the timeline by when events happened rather than when they arrived.
Timelines stay accurate even when a batch of updates syncs at once after reconnecting.
Heavy Proof-of-Delivery Uploads
Photos and signatures uploaded through the API slowed down requests and used a lot of server bandwidth.
Issued short-lived pre-signed URLs so the app uploads directly to storage, then confirms the upload with a lightweight API call.
API requests stay fast and uploads are more reliable on mobile connections.
Core Features
Shipment Tracking
Customer-facing timeline with each milestone, time and location.
Clean Code
1// Idempotent status updates: replays after reconnecting are ignored2router.post("/shipments/:id/events", auth, validate(eventSchema), "color:#c792ea">async ("color:#ffcb6b">req, "color:#ffcb6b">res) => {3 "color:#c792ea">const { status, occurredAt, lat, lng, idempotencyKey } = "color:#ffcb6b">req.body;45 "color:#c792ea">await db.query(6 `INSERT IGNORE INTO shipment_events7 (shipment_id, idempotency_key, status, occurred_at, lat, lng)8 VALUES (?, ?, ?, ?, ?, ?)`,9 ["color:#ffcb6b">req.params.id, idempotencyKey, status, occurredAt, lat, lng] // occurredAt = device time10 );1112 "color:#c792ea">const shipment = "color:#c792ea">await shipments.refreshStatusFromEvents("color:#ffcb6b">req.params.id);13 "color:#ffcb6b">res.status(201).json(shipment);14});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.