MWMartin Wassim
Return to Selected Work
ARCHITECTURAL DOSSIER // 2024—2026
PROJECT 03Operations Management & High ConcurrencyAmazon Now Hub — Production System

QR DELIVERY QUEUE

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

martinx.work/work/qr-delivery-queue
QR DELIVERY QUEUE Architectural Presentation
TIMELINE

2024 — 2026

DISCIPLINE

Systems Engineering

ROLE

Lead Software Architect

AFFILIATION

Systemize EG · Cairo

Core Runtime • Engineering Toolchain
Next.jsTypeScriptTailwind CSSSupabasePostgreSQLRealtimeWeb Audio API
01 // Operational & Technical Friction

The Problem Space

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 // Production 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.

Engineering Depth

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 // Architectural Flow & State MachineBespoke Pipeline
CONCURRENCY ENGINE

QR DELIVERY QUEUE // HIGH-CONCURRENCY DISPATCH (AMAZON NOW HUB)

PRODUCTION DEPLOYED • SUB-50MS
TOUCHPOINT 01 // CONTACTLESS

Dynamic QR Ingress

Couriers scan physical hub QR on arrival; client issues idempotent arrival token without app installation.

NODE 01ONLINE
Core Innovation
TOUCHPOINT 02 // DATABASE LOCK

PostgreSQL SELECT FOR UPDATE

Transactional row-level locking eliminates ticket duplication and race conditions during simultaneous burst arrivals.

NODE 02VERIFIED
TOUCHPOINT 03 // DISPATCH CONSOLE

Warehouse Operator Station

Real-time ticket routing console syncs package staging bays via bi-directional WebSockets under 50ms latency.

NODE 03ONLINE
TOUCHPOINT 04 // AUDITORY NOTICE

Ceiling Display & Web Audio Chime

Full-screen warehouse monitor triggers high-contrast visual callouts and distinct acoustic cues for drivers.

NODE 04ONLINE

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

Core System Features

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