PROJECT 04Operations Management & High ConcurrencyAmazon Now Hub — Production System

QR DELIVERY QUEUE

Mission-critical courier dispatch and concurrency control for Amazon Now, Al-Haram Hub.

QR DELIVERY QUEUE // HIGH-CONCURRENCY DISPATCH • AMAZON NOW HUB
PRODUCTION DEPLOYED
TOUCHPOINT 01
Contactless QR

Couriers scan hub QR; instant idempotency token generated on mobile.

TOUCHPOINT 02
Row-Level Lock

SELECT FOR UPDATE in PostgreSQL guarantees zero duplicate tickets.

TOUCHPOINT 03
Operator Console

Staff dispatch dashboard synchronizes state via WebSockets under 50ms.

TOUCHPOINT 04
Wall Display Chime

Full-screen warehouse TV flashes courier number with Web Audio chime.

TECH STACK • CORE RUNTIME
Next.jsTypeScriptTailwind CSSSupabasePostgreSQLRealtimeWeb Audio API
DOMAIN DISCIPLINE
Systems Engineering
Author: Martin Wassim
VERIFIED INTERFACE ARTIFACTS & ARCHITECTURAL DIAGRAMS
5 visual assets
QR DELIVERY QUEUE screenshot 1
Figure 1: QR DELIVERY QUEUE — Visual EvidenceVerified Production Asset
QR DELIVERY QUEUE screenshot 2
Figure 2: QR DELIVERY QUEUE — Visual EvidenceVerified Production Asset
QR DELIVERY QUEUE screenshot 3
Figure 3: QR DELIVERY QUEUE — Visual EvidenceVerified Production Asset
QR DELIVERY QUEUE screenshot 4
Figure 4: QR DELIVERY QUEUE — Visual EvidenceVerified Production Asset
QR DELIVERY QUEUE screenshot 5
Figure 5: QR DELIVERY QUEUE — Visual EvidenceVerified Production Asset
01 / THE PROBLEM BEING SOLVED

Operational & Technical Friction

During peak fulfillment windows, tens of couriers scan entry simultaneously. Without strict concurrency controls, duplicate sequence IDs, double-calling, and queue disputes disrupt operations.

02 / THE ARCHITECTED SOLUTION

Systemized Implementation

Constructed an atomic transaction flow in PostgreSQL using row locks and client idempotency tokens, paired with a low-latency realtime broadcasting layer.

03 / ACTUAL IMPLEMENTATION & WORKFLOW

How It Operates in Production

Developed with Next.js, TypeScript, and Supabase Realtime. Designed three distinct interfaces: an RTL mobile ticket interface for drivers, an administrative dispatch board for hub managers, and a kiosk TV display with synthesizer sound cues.

Crafted a resilient multi-screen interface (courier mobile, staff tablet, wall-mounted display) with zero-refresh WebSockets, offline warning alerts, and audio synthesize cues.

04 / SYSTEM ARCHITECTURE EXPLANATION

Data Flow & Infrastructure

Drivers scan a dynamic QR code generating a mobile ticket with a unique token. The request executes a PostgreSQL stored procedure with row-level locks. Supabase Realtime triggers broadcast events to operator workstations and wall-mounted TV monitors in under 50ms.

Architectural Highlight: Database row locking (FOR UPDATE) and cryptographic idempotency keys prevent race conditions and duplicate ticket generation under heavy courier arrival bursts.
05 / KEY ENGINEERING DECISIONS
Database row locking: Utilized `SELECT ... FOR UPDATE` transactions within PostgreSQL functions to increment queue counters deterministically under concurrent traffic.
Idempotency keys: Client-generated UUIDs ensure that duplicate network requests from flaky mobile connections cannot create redundant queue entries.
Audio chime dispatch: Implemented Web Audio API synthesis on TV displays to ensure clear acoustic notification without depending on external audio file downloads.
Sub-second sync: Powered by Supabase Realtime WebSocket subscriptions, broadcasting state transitions across all connected warehouse screens instantaneously.
06 / CHALLENGES & MITIGATIONS
•Eliminating race conditions during peak 5:00 PM driver check-in bursts.
•Supporting intermittent mobile connectivity among drivers waiting outside concrete loading docks.
•Ensuring clean Arabic RTL typography and high contrast for outdoor sunlight readability.
07 / VERIFIED CAPABILITIES
Contactless QR-based courier queue entry with instant ticket generation
Full Arabic right-to-left (RTL) mobile courier ticket view
Live operator dispatch dashboard for hub staff and station leads
Full-screen public TV display with automated chime alerts via Web Audio API
Real-time status synchronization powered by Supabase WebSockets
Shift management, cooldown enforcement, and courier rotation rules
Comprehensive audit trail recording every state transition with timestamps
16 automated end-to-end integration tests verifying concurrency guarantees