Case Study #01 • Hyperlocal Marketplace Architecture

GharTak (گھر تک)

Two-Sided Hyperlocal On-Demand Delivery & Pharmacy Marketplace

How RafayLabs re-engineered a localized pharmacy ordering platform into a decentralized, real-time two-sided marketplace powered by multimodal requests (voice notes & handwritten slips) and sub-second socket negotiation.

01 // METRIC

DUAL-ROLE ENGINE

Single Codebase Architecture

Customer and Business (Pharmacy) portals unified in 1 clean Expo mobile app with zero separate desktop requirements.

02 // METRIC

3-WAY MULTIMODAL

Voice, Parchi & Freeform Lists

Instant order requests via native audio voice notes, handwritten prescription photos, or freeform text items.

03 // METRIC

<1.2s SOCKET LATENCY

Live Negotiation Flow

Real-time state updates powered by Socket.IO and Neon Serverless Postgres for sub-second quote delivery.

04 // METRIC

ZERO-STOCK OVERHEAD

Decentralized Marketplace

Local pharmacies manage inventory & delivery directly; platform operates as high-margin B2B SaaS.

GharTak Marketplace Mobile App Showcase
FIGURE 1.0: GHARTAK MARKETPLACE MULTI-ROLE CLIENT & PHARMACY UISTATUS: PRODUCTION ARCHITECTURE
01 / System Evolution

The Strategic Pivot

Moving from central fleet dispatch to a decentralized marketplace unlocked exponential scale.

✕

The Legacy Local Delivery Bottleneck

Originally, GharTak operated as a single pharmacy delivery service where the founder employed dedicated riders and maintained a centralized catalog. This created severe operational friction:

  • •Rider Management Overhead: Solo fleet coordination, absenteeism, and manual dispatching became recurring non-technical bottlenecks.
  • •Heavy Central Catalog Maintenance: Manually synchronizing inventory, dosage variations, and daily price fluctuations across hundreds of pharmaceutical SKUs.
  • •Geographic Confinement: Delivery boundaries were constrained strictly to where internal riders were physically stationed.
✓

The Decentralized Two-Sided Platform

GharTak was architected into a pure digital marketplace. The platform connects consumers directly with local pharmacies, shifting fulfillment responsibility to the merchant:

  • •Store-Led Last-Mile Delivery: Pharmacies fulfill orders using their existing counter delivery staff, eliminating platform fleet liabilities.
  • •Freeform Request-to-Quote Engine: Businesses quote prices and discounts on demand without needing to catalog thousands of items upfront.
  • •Clean B2B SaaS Recurring Revenue: Pharmacies pay a predictable monthly subscription; transactions and cash-on-delivery remain friction-free.
02 / Engineering Pillars

Core Innovations

Overcoming literacy and typing barriers in emerging markets through multimodal intake.

FEATURE 01

Voice Note Ordering

Customers record an Urdu or English audio clip describing their medicine needs or symptoms. The audio is uploaded directly to Firebase Storage CDN and delivered to the pharmacist in sub-second latency.

FEATURE 02

Prescription Parchi Vision

Users snap a photograph of a doctor's handwritten prescription slip ("Parchi") or paper list. The pharmacist reviews the high-resolution image directly in the business app interface to prepare accurate doses.

FEATURE 03

Dynamic Quoting Engine

Instead of forcing stores into rigid catalog pickers, pharmacists enter freeform item names, quantities, prices, and per-item discounts. The customer receives a clear, transparent quote to accept or decline.

ARCHITECTURAL RULE // RESILIENT LIFECYCLE STATE MACHINE

A single PostgreSQL entity governs the entire order lifecycle with zero duplicate tables or race conditions. Socket.IO broadcasts status events instantly to both customer and merchant clients:

STAGE 01
pending_review
Customer creates order request
STAGE 02
quoted
Store sends itemized quote
STAGE 03
confirmed
Either party accepts quote
STAGE 04
delivered
Pharmacy marks fulfillment
03 / Reusable Product Blueprint

Architectural DNA

If We Can Architect GharTak, Here Is What We Can Build For Your Startup.

Engineering an on-demand marketplace or logistics platform from scratch typically takes 6 to 9 months of painful architectural trial and error. Because RafayLabs solved the foundational complexities in GharTak—two-sided role switching, sub-second socket negotiation, GPS pinning, and state machines—we can adapt this battle-tested engine to ship your next product in weeks, not quarters.

01 // ADAPTATION

RIDE-HAILING & CARPOOLING APPS

Blueprint: Uber / InDrive / Careem Model

Passenger creates a ride request with origin & destination GPS pins. Nearby drivers receive the request, submit bids/fares, and passenger confirms. The state machine transitions in real time from Bid Accepted to Driver Arrived to En Route.

Core GharTak Engine Utilized:
Live Geolocation Pinning (LocationIQ & Maps)
Two-Sided Matching & Counter-Offer Quotation
Socket.IO Real-Time State Transitions
Bilingual Localization & Push Triggers
02 // ADAPTATION

ON-DEMAND COURIER & PARCEL DISPATCH

Blueprint: Porter / Dunzo / Lalamove Model

Sender takes a photo of the parcel, specifies dimensions/weight, and sets pickup and dropoff coordinates. Local couriers quote pricing based on distance and vehicle type, with photographic proof of delivery upon dropoff.

Core GharTak Engine Utilized:
Multimodal Image & Parcel Intake
A-to-B Distance & Geofencing Calculation
Resilient Single-Entity Order Machine
Firebase Storage CDN File Handling
03 // ADAPTATION

ON-DEMAND HOME SERVICES & HANDYMAN

Blueprint: Urban Company / TaskRabbit Model

Homeowner records a voice note or snaps a picture of an AC leak, plumbing issue, or electrical fault. Verified local technicians review the request, assemble a custom line-item quote with parts & labor, and confirm the visit.

Core GharTak Engine Utilized:
Audio Voice-Note Problem Description
Dynamic Line-Item Quoting with Discounts
In-App Store/Technician Direct Confirmation
Role-Gated Dashboard Inside Single App
04 // ADAPTATION

HYPERLOCAL DARK STORES & DIRECT COMMERCE

Blueprint: Blinkit / Talabat / Zepto Model

Neighborhood merchants and mini-fulfillment centers receive instant consumer order requests. Stores accept and assemble orders rapidly, bypassing heavy centralized stock reconciliations with a lightweight monthly SaaS subscription.

Core GharTak Engine Utilized:
Radius-Based Merchant Discovery
Flat B2B SaaS Recurring Monetization
Redux Toolkit & RTK Query State Caching
Cash-on-Delivery Direct Settlement

Have a unique on-demand workflow in mind?

Whether you need driver bidding, service dispatching, or multimodal orders, we already own the building blocks.

Discuss Your App Idea →
04 / System Architecture

Production Tech Stack

Engineered for high throughput, sub-second event synchronization, and zero server management overhead.

01 // FRONTEND

React Native & Expo

Expo SDK 54, Redux Toolkit, RTK Query cache invalidation, Native Audio Recording, and Bilingual RTL localization.

Expo SDK 54RTK QueryTypeScript

02 // BACKEND

NestJS 11 & Socket.IO

Modular architecture with dedicated Order-Requests gateway, JWT role-based auth guards, and real-time state broadcasts.

NestJS 11Socket.IOTypeORM

03 // DATA LAYER

Neon Postgres & Firebase

Serverless PostgreSQL with instant DB branching, paired with Firebase Storage CDN for audio and prescription image assets.

Neon PostgresFirebase Storage

04 // GEOLOCATION

LocationIQ & Maps

Reverse geocoding for informal delivery addresses, interactive GPS pin dropping, and radius-based pharmacy filtering.

LocationIQGoogle Maps
Launch Your On-Demand Product

Ready To Build Your Next Marketplace Or Mobile App?

Skip months of architectural guesswork. Let's engineer your production-grade MVP in 4 weeks backed by proven, scalable foundations.