Ordering dinner looks effortless from a customer's phone: browse nearby kitchens, customize toppings, tap pay, and watch a rider approach on a live map. Behind that simple flow sits a time-sensitive, three-sided logistics engine where a two-minute failure at the kitchen tablet leaves riders idling outside, food cooling on counters, and support teams issuing refunds.
If you are launching a hyperlocal meal marketplace, cloud-kitchen network, or multi-branch restaurant delivery product, your v1 architecture must solve perishable timing, menu complexity, and concurrent rider assignment cleanly from day one.
Scope Four Distinct Surfaces—Not Four Separate Native Teams
Early founders frequently burn half their seed budget building four heavyweight native apps simultaneously. Match each user surface to its real operational environment:
| Product Surface | Practical Tech Stack | Primary Jobs | Why This Choice Ships Faster |
|---|---|---|---|
| Customer Mobile App | Flutter or React Native | Zone discovery, modifier builder, wallet checkout, map ETA | Single codebase across iOS and Android |
| Courier Mobile App | Flutter + native background location | Job alerts, pickup checklist, photo drop-off proof | Reliable background GPS + offline local queue |
| Kitchen Tablet Portal | Responsive Web App (PWA) | Persistent chime alerts, prep-time selector, instant item pause | Instant hotfixes without App Store review delays |
| Operations Console | Web Admin Dashboard | Live zone heat map, manual rider reassignment, payout ledger | Lets dispatchers rescue stuck orders immediately |
Shipping the restaurant tablet interface as a browser-based PWA with WebSocket audio alerts—following clean state-separation principles like those in the Android app architecture guide—cuts weeks off initial launch while keeping menu updates instantaneous.
Menu Modifiers and Immutable Order Snapshots
Restaurant menus carry complex validation rules: Select crust (required, choose 1), add toppings (optional, max 5, first 2 included, extra $1.25 each), exclude allergens. Never trust price totals sent from a mobile client—recalculate every subtotal, delivery fee, tax, and promo discount strictly on the server before creating a payment intent.
Just as critical: freeze the purchased snapshot at checkout. If a restaurant raises burger prices next morning, historical customer receipts and accounting payouts must never shift retroactively.
CREATE TABLE delivery_orders (
id UUID PRIMARY KEY,
customer_id UUID NOT NULL,
kitchen_id UUID NOT NULL,
courier_id UUID,
status VARCHAR(32) NOT NULL,
-- 'awaiting_kitchen' | 'preparing' | 'ready' | 'en_route' | 'delivered' | 'cancelled'
subtotal_cents INT NOT NULL,
delivery_fee_cents INT NOT NULL,
tax_cents INT NOT NULL,
tip_cents INT NOT NULL,
total_cents INT NOT NULL,
prep_minutes SMALLINT,
handoff_pin CHAR(4) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TABLE delivery_order_lines (
id UUID PRIMARY KEY,
order_id UUID NOT NULL REFERENCES delivery_orders(id) ON DELETE CASCADE,
menu_item_id UUID NOT NULL,
item_title_snapshot VARCHAR(160) NOT NULL,
unit_price_cents INT NOT NULL,
quantity SMALLINT NOT NULL,
modifiers_snapshot JSONB NOT NULL DEFAULT '[]'::jsonb
);
Storing currency amounts in integer cents prevents rounding drift across split payouts, taxes, and courier earnings.
The Kitchen Acceptance Escalation Loop
In live food delivery, nothing hurts retention faster than a paid order sitting unnoticed on a kitchen counter during Friday rush while the customer assumes food is cooking.
Model kitchen confirmation as an automated escalation pipeline backed by Redis job timers:
- T+0s (Authorization Only): Authorize the buyer's card without capturing funds immediately. Push the ticket over WebSockets and trigger a loud looping chime on the kitchen tablet.
- T+90s (Manager Fallback): If the order stays in
awaiting_kitchen, trigger an automated SMS or programmable voice call to the store manager on duty. - T+300s (Clean Auto-Void): Automatically mark the order
cancelled, release the card authorization immediately—avoiding settlement refund fees—and prompt the buyer with nearby open kitchens.
When the kitchen taps Accept, capture payment and require a realistic prep estimate (15, 25, or 35 minutes). That confirmed prep timestamp—not the moment the customer clicked pay—anchors courier scheduling.
Timing Courier Dispatch Without Idle Riders
Assigning a rider the second an order enters the kitchen wastes 15 to 20 minutes of courier time per trip, destroying unit economics. Compute a just-in-time dispatch trigger instead:
$$\text{Dispatch Time} = \text{Estimated Ready Time} - \text{Rider Travel Time to Kitchen} - \text{Buffer (3 min)}$$
Atomic Assignment Locking in Redis
When broadcasting a nearby delivery ping to available couriers, two riders tapping Accept within the same 50 milliseconds must never claim the same bag. Guard assignment with a short-lived Redis SET NX lock paired with a conditional SQL update:
async function claimDeliveryAssignment(orderId: string, courierId: string): Promise<boolean> {
const lockKey = `dispatch:claim:${orderId}`;
const lockAcquired = await redis.set(lockKey, courierId, 'PX', 12000, 'NX');
if (!lockAcquired) {
return false;
}
const rowsUpdated = await db('delivery_orders')
.where({ id: orderId, courier_id: null })
.whereIn('status', ['preparing', 'ready'])
.update({ courier_id: courierId, updated_at: db.fn.now() });
return rowsUpdated === 1;
}
If the first rider drops or times out, release the lock and advance the dispatch ping to the next closest rider ranked by PostGIS distance and current active load.
Smooth Live Map Tracking and Drop-Off Proof
Once a courier picks up the bag, avoid hammering REST endpoints every second from thousands of customer phones.
- WebSocket room updates: Courier devices emit
[lat, lng, bearing, speed]every 4–6 seconds while moving, publishing to a scopedorder:{id}channel. - Client-side marker smoothing: Interpolate the rider marker cleanly between coordinate ticks on the customer map so frame rates stay smooth, applying the rendering discipline outlined in Flutter performance best practices.
- Dispute-proof handoff: Require either a timestamped drop-off photo or a 4-digit
handoff_pinverification on doorstep orders so support resolves missing-order disputes in seconds.
For founders deciding how to structure cross-platform teams and zone rollouts before writing code, read our mobile app development guide for global startups.
Launch Your Delivery Platform With SmitDev
Building a three-sided logistics product demands tight alignment between mobile UX, real-time queues, and payment settlement—not fragmented freelancers working in silos. Across 170+ shipped engagements since 2017, I work directly with founders as a Forward Deployed Engineer to architect and ship customer apps, courier apps, kitchen portals, and dispatch backends end-to-end.
Start with a focused launch consulting engagement to lock down your dispatch rules and schema, or bring on senior execution at $55/day (8–9 dedicated daily hours) or $1,999/month continuous delivery—plus $399 7-day marketing sites when you need a fast restaurant or city waitlist landing page. Explore our mobile app development services or contact us directly to plan your v1 release.