HomeCase studiesHyperlocal Online Grocery Marketplace and Cold-Chain Slot...

Case study · Doha, Qatar

Hyperlocal Online Grocery Marketplace and Cold-Chain Slot Delivery Platform Built with Flutter, NestJS, and PostgreSQL

Hyperlocal Quick-Commerce & Slot Delivery

Quick-commerce grocery delivery breaks down when shoppers check out items that vanish off dark-store shelves before pickers reach the aisle, or when delivery slots overbook during evening peaks. Built for hyperlocal operations in Doha, we engineered an online grocery marketplace uniting cross-platform Flutter apps for shoppers, pickers, and riders with modular NestJS domain services and a PostGIS-enabled PostgreSQL core. The platform coordinates dynamic zone-based delivery slots, atomic aisle-level stock reservations, live substitution approvals, and catch-weight payment adjustments.

Industry
Hyperlocal Quick-Commerce & Slot Delivery
Solution
A full-stack hyperlocal grocery marketplace comprising Flutter mobile applications for consumers, pickers, and couriers, backed by NestJS microservices and a PostgreSQL/PostGIS operational ledger.
Platforms
Cross-platform · Web & API
Stack
Flutter · NestJS · PostgreSQL · PostGIS · Redis · TypeScript
Location
Doha, Qatar · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Doha, Qatar. Names withheld by agreement.

Project Overview

Online grocery fulfillment operates under unforgiving physical constraints that standard parcel e-commerce never encounters. Fresh produce sells by variable weight, frozen goods cannot wait in ambient staging areas, and dozens of shoppers compete simultaneously for the same evening delivery windows across dense urban neighborhoods.

Engineered for hyperlocal quick-commerce operations in Doha, we built an end-to-end online grocery marketplace connecting Flutter consumer, picker, and rider applications to a modular NestJS backend and a PostgreSQL database extended with PostGIS. Every layer is purpose-built around dark-store inventory accuracy, cold-chain time windows, and real-time substitution workflows.

Hyperlocal Grocery Bottlenecks

Regional supermarket aggregators and rapid-delivery operators frequently hit structural breakdowns between digital carts and physical warehouse aisles:

  • Phantom shelf inventory: Delayed ERP batch syncs allowed shoppers to purchase fresh dairy or bakery items already cleared from dark-store shelves.
  • Peak-hour slot overbooking: Naive checkout validation permitted concurrent buyers to claim the final van capacity in a high-demand delivery window.
  • Unresolved substitution friction: Phone calls from busy pickers stalled packing lines whenever shoppers missed unknown caller IDs.
  • Catch-weight settlement errors: Fixed-amount card captures forced messy partial refunds or manual cash reconciliations whenever deli and produce weights varied from catalog estimates.

Architectural Strategy

We unified catchment geospatial routing, atomic slot/inventory locking, and real-time picker-to-shopper orchestration inside a cohesive NestJS service architecture. PostgreSQL with PostGIS serves as the authoritative ledger for store catchment polygons, aisle bin locations, multi-zone slot capacity, and financial settlements.

Redis sits directly in front of high-contention paths—holding transient checkout slot locks, ephemeral cart stock reservations, and live rider GPS coordinates—while NestJS WebSocket gateways connect Flutter picker tablets and consumer phones into an interactive fulfillment loop during active order assembly.

Core Capabilities

  • Catchment-Aware Storefront & Catalog (Flutter): Resolves shopper GPS pins via PostGIS to show live neighborhood store stock, ambient/chilled/frozen tags, and bilingual RTL/LTR merchandising layouts.
  • Dynamic Slot & Express Dispatch Engine: Balances scheduled multi-hour delivery windows alongside rapid express tiers, throttling slot availability automatically by picker queue depth and fleet capacity.
  • Guided Dark-Store Picker App (Flutter): Sequences pick lists by store aisle and temperature zone (ambient first, chilled and frozen last) with barcode validation and Bluetooth scale capture.
  • In-App Live Substitution Approvals: Pushes one-tap visual swap prompts to shoppers via WebSockets and push notifications when a shelf item fails quality inspection.
  • Cold-Chain Rider Dispatch & Proof of Delivery: Bundles temperature-compatible orders into optimized multi-drop routes with OTP or photo handoff verification.

Technical Architecture

Shopper apps, picker devices, and rider clients connect over HTTPS and authenticated WebSocket channels into NestJS API gateways. Geospatial queries and transactional order commitments persist in PostgreSQL/PostGIS, while Redis coordinates distributed slot locks and live driver telemetry streams.

Flow: Flutter Consumer / Picker / Rider Apps → NestJS REST & WebSocket Gateways → Redis Slot Locks & Geo Streams → NestJS Domain Services (Catalog, Picking, Dispatch) → PostgreSQL & PostGIS Operational Ledger → Payment Pre-Auth & Push Gateways

Aisle-sequenced pick lists and temperature-staged packing ensure frozen goods spend minimal time outside refrigeration prior to courier handoff.

Technology Stack

Category Technology detail
Consumer & Field Apps Flutter cross-platform iOS/Android apps for shoppers, dark-store pickers, and riders
Operations Portal Web console for category merchandising, slot capacity tuning, and live dispatch
Service Backbone NestJS TypeScript modular services handling catalogs, slots, picking, and settlements
Relational & Geo DB PostgreSQL with PostGIS resolving catchment polygons, store stock, and order ledgers
Concurrency & Locks Redis managing short-lived cart reservations, slot counters, and driver geo-streams
Real-Time Sync NestJS WebSockets streaming live substitution prompts and courier GPS telemetry
Payment Pre-Auth Gateway tokenization supporting authorization holds and final catch-weight capture
Push & Alerts FCM and APNs delivering instant substitution approvals and doorstep arrival alerts

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Holding hard PostgreSQL locks during multi-minute shopper checkouts stalls concurrent carts Used short-TTL Redis slot and SKU reservation keys backed by atomic PostgreSQL state transitions on payment pre-auth; trades strict long-held DB locks for responsive checkout concurrency.
Variable produce/butchery weights differ from catalog estimates Implemented buffered payment authorization holds at checkout followed by exact final-weight capture once the picker weighs items; adds gateway state-machine complexity but eliminates cash/refund friction.
Freezer and basement dark-store aisles suffer intermittent Wi-Fi drops Built offline-capable local SQLite pick queues inside the Flutter picker app that reconcile barcode scans upon reconnect, avoiding stalled warehouse shifts.
Polling rider locations over REST drains mobile batteries and saturates API pods Streamed throttled adaptive GPS updates over persistent WebSocket channels backed by Redis Geo sets, scaling live map views smoothly.

Security & Operational Reliability

Marketplace operations span consumer addresses, payment authorizations, and third-party supermarket partner payouts. NestJS enforces JWT-backed role separation isolating consumer profiles, store-scoped picker terminals, courier delivery tokens, and finance administrators.

Payment instruments tokenize directly with certified regional payment gateways so raw card details never traverse NestJS containers. Every inventory adjustment, damaged-stock write-off, and substitution approval writes an immutable audit trail in PostgreSQL for clear vendor reconciliation.

Performance & Peak-Hour Scale

Grocery demand clusters sharply around morning prep windows and pre-dinner evening hours. Caching neighborhood catalog trees and promotional banners per store in Redis keeps Flutter storefront scrolling fluid even during weekend rushes, while PostGIS spatial indexes (GIST) resolve delivery zones in single-digit milliseconds.

NestJS stateless service pods scale horizontally behind load balancers, and heavy background tasks—supplier ERP catalog syncs, daily vendor settlement PDFs, and abandoned slot sweeps—run on isolated worker queues so live checkouts never contend with batch jobs.

Operational Outcomes

Integrating shopper discovery, dark-store picking, and cold-chain delivery onto a single Flutter, NestJS, and PostgreSQL platform reshaped daily fulfillment execution:

  • Accurate shelf-to-basket fulfillment: Aisle-guided picking and short-TTL reservations dramatically cut out-of-stock surprises after checkout.
  • Streamlined substitution resolution: Real-time in-app prompts replace slow outbound support calls, keeping packing stations moving smoothly toward dispatch cutoffs.
  • Balanced cold-chain integrity: Zone-aware pick sequencing keeps chilled and frozen items temperature-controlled until riders depart.
  • Predictable peak slot management: Catchment-level capacity throttling protects courier SLAs during evening order surges without manual dispatch intervention.

01 — Questions

asked about this kind of project

How does the system handle fresh produce and meat sold by variable weight rather than fixed units?

Checkouts place an authorization hold slightly above the estimated item weight using configurable buffer percentages. Once the dark-store picker scans the actual scale weight in the Flutter picker app, NestJS captures the exact final amount automatically without requiring a second customer payment step.

How do you prevent multiple shoppers from booking the same peak evening delivery slot simultaneously?

Delivery slots enforce hard capacity limits per catchment zone and dark store using atomic Redis decrement counters paired with optimistic PostgreSQL slot locks. Slots hold temporarily during checkout initiation and release automatically if payment fails or expires.

What happens when a picker discovers a requested grocery item is damaged or missing on the shelf?

Scanning an out-of-stock shelf triggers pre-ranked substitution candidates in the Flutter picker app. NestJS pushes an instant WebSocket and push notification to the shopper's app with a countdown timer to approve, swap, or skip the item before order packing closes.

How does PostGIS route shoppers to the correct dark store or partner supermarket?

Customer delivery pins evaluate against PostGIS catchment polygons factoring neighborhood boundaries, current slot congestion, and cold-chain travel limits rather than naive straight-line radius circles.

Can pickers continue scanning items if warehouse freezer aisles experience patchy Wi-Fi?

The Flutter picker app caches the assigned pick-list and barcode catalog locally in encrypted SQLite storage, queuing scan events and weight entries reliably offline before syncing deltas cleanly once connectivity returns.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.