GreenMart is a quick-commerce grocery platform delivering fresh organic produce and pantry staples within 30 minutes from localized dark stores. Their initial platform lacked geospatial store routing, causing orders to be assigned to dark stores lacking required inventory, resulting in missed delivery windows. codeYB engineered a hyperlocal logistics engine powered by MongoDB geospatial indexing ($nearSphere), real-time rider GPS tracking, and automated dark-store batching.
Core Business Imperative
Assigning delivery orders to dark stores with missing inventory led to painful substitutions, courier delivery delays, and high customer refund demands. GreenMart needed deterministic inventory allocation tied to exact customer GPS locations.
π
Existing Technical Problems & Legacy Bottlenecks
Bottleneck #1
Relational Distance Calculations in SQL
Executing Haversine formula calculations across thousands of customer coordinates slowed database queries to over 1.8 seconds.
Bottleneck #2
Un-synchronized Dark Store Barcode Scanners
Pickers scanning items did not deduct inventory from the web catalog in real time, leading to simultaneous customer checkouts for non-existent stock.
Bottleneck #3
High Battery Consumption on Rider Mobile Devices
Poorly optimized continuous GPS tracking drained delivery rider phone batteries within 3 hours of dispatch.
β οΈ Core Engineering & Operational Roadblocks
1. Mismatched Store Routing & Order Cancellations
Customers ordered items that were out-of-stock at their nearest dark store because the legacy app checked regional rather than local dark-store stock.
2. Lack of Real-Time Courier Tracking for Customers
Customers had no visibility into delivery rider locations, leading to thousands of frantic support ticket queries every day.
3. Inefficient Rider Route Dispatching
Manual dispatcher phone calls to couriers caused orders to sit at dark stores for up to 15 minutes before pickup.
π‘ Architectural Solutions Engineered by codeYB
β MongoDB 2dsphere Hyperlocal Store Matcher
Engineered a geospatial engine using MongoDB $nearSphere queries that instantly identifies the nearest operational dark store with active inventory.
Battery-optimized rider mobile app transmitting GPS coordinates every 2.5 seconds
Customer order tracking screen with interactive Mapbox route polyline and estimated arrival time (ETA)
One-tap contactless delivery photo confirmation uploaded upon drop-off
ποΈ
Hyperlocal Quick-Commerce Cloud Topology
Customer coordinates hit a geospatial API layer that indexes dark store service polygons via MongoDB 2dsphere indexes. Pickers update shelf inventory via handheld WebSockets. Active couriers transmit compressed GPS coordinates to a Node.js socket server, broadcasting live positions to customer map clients.
End-to-End Enterprise Data Flow & Pipeline
Customer Location / Order PlacementβMongoDB 2dsphere Dark Store MatchβDark Store Picker Tablet AlertβCourier Assigned & DispatchedβLive WebSocket Mapbox Tracking
β‘MongoDB 2dsphere index calculating store proximity in under 25ms
β‘WebSocket location broker streaming rider GPS coordinates every 2.5 seconds
π Telemetry SourceGreenMart customer cohort analytics and app loyalty telemetry
π Architectural ChangeOn-time delivery SLA guarantee and real-time rider map tracker in mobile app
π’ Data SupplierGreenMart Analytics & Customer Success Team
πEmpirical Evidence & Measurement Methodology
Every performance improvement, latency drop, and conversion lift reported by codeYB is audited against pre-release baselines using real user monitoring (RUM), APM distributed tracing, and verified client operational telemetry.
Seasonality Controlβ Controlled: Normalized across monsoon rain disruptions and evening dinner rush hour surges
Measurement TelemetryGreenMart Dispatch & Delivery Telemetry Logs and Dark-Store Barcode Scanner Records
Auditing SupplierGreenMart Operations Director and codeYB Logistics Engineering telemetry
ENTERPRISE DELIVERABLES
Key Engineering & Architectural Features
π
Sub-25ms Dark Store Match
Instantly locates the closest operational fulfillment center with guaranteed in-stock produce.
π΅
Live Courier GPS Tracking
Real-time Mapbox map tracking shows exact delivery rider movement and accurate arrival countdowns.
π¦
Shelf-Accurate Inventory
Barcode scanner integration ensures items added to carts are physically reserved on store shelves.
πΈ
Contactless Photo Proof
Couriers take a confirmation photo upon door delivery, automatically sent to the customer via SMS/app.
Store service zones are represented as GeoJSON polygons. When a user opens the app, a $geoIntersects or $nearSphere query returns the active fulfillment dark store in under 25ms.
MongoDB 7.0 GeoJSON Polygon indexing with sub-meter coordinate precision
Binary Packed WebSocket GPS Telemetry
Rider GPS coordinates are packed into compact binary byte buffers rather than heavy JSON strings, reducing cellular data transmission by 85% and saving mobile battery life.
Binary ArrayBuffer WebSocket frames transmitting lat, lng, heading, and speed
β
Architecture & Technical Review Note
"codeYB built our entire quick-commerce infrastructure from dark-store picking to customer live tracking. Our delivery time dropped to 21 minutes and out-of-stock cancellations are now practically zero."
Vikram Patelπ Reference Implementation Lead
Operations Director, GreenMart Quick-Commerce
GreenMart Quick-Commerce
π
Geospatial Data Anonymization & Driver Protection
π‘οΈ ISO 27001 ISMS Alignedπ‘οΈ GDPR Chapter III Alignedπ‘οΈ Payment Tokenization
Ephemeral Customer Phone Masking
Customer and delivery driver communicate via virtual VoIP masking without exposing actual personal phone numbers.
Driver GPS Telemetry Encryption
Location coordinates transmitted over TLS 1.3 WebSockets and auto-purged from hot storage after 48 hours.
Dark-Store Scanner Audit
Barcode handheld scanners authenticated via cryptographic mutual TLS certificates.
π‘
Lessons Learned & Senior Architectural Takeaways
1. Pin-Code Matching Is Not Accurate Enough for Quick-Commerce
Postal pin-codes are arbitrary geographic areas that cross natural barriers like rivers or highways. Switching to polygon geospatial boundaries cut average delivery drive times by 12 minutes.
2. Real-Time Map Transparency Slashes Support Costs
Letting customers see their rider moving live on a map reduced 'Where is my order?' support tickets by over 90%.
π₯
Senior Engineering Squad & Project Authors
Published: February 22, 2026 β’ Last Audited: September 17, 2026
AK
Mr. Avinash Kumar
Lead Enterprise Logistics Architect
Geospatial RoutingDark Store Inventory SystemsMulti-AZ Cloud
Every item scanned by shelf pickers is decremented atomically in the dark-store database. When stock falls below a threshold, the SKU is hidden automatically from customer apps within 1 second.
π
Related codeYB Services & Engineering Capabilities