Skip to content

nahorfelix/Real-Time-Geospatial-Marketplace-Engine-h3-hyperdrive-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Build & Test

Real-Time Geospatial Marketplace Engine (H3-Hyperdrive) 🚀

Go Version Redis Uber H3

A high-concurrency, low-latency pricing engine designed to balance supply and demand in real-time marketplaces. This system simulates the core logic used by global ride-hailing platforms to manage dynamic surge pricing across geographic tiles.

🏗 System Architecture

The engine is built on a distributed architecture to ensure sub-millisecond price calculations:

  • Spatial Indexing: Utilizes Uber’s H3 Discrete Global Grid (Resolution 8) to partition the earth into hexagons, avoiding the "boundary edge" issues of traditional circular geofencing.
  • State Management: High-speed Redis atomic counters store real-time driver/rider presence.
  • Concurrency: Built with Go (Golang) and the Fiber web framework for maximum throughput.
  • Automatic Decay: Implements Redis TTL (Time-To-Live) logic; if a driver stops pinging for 60 seconds, they are automatically evicted from the surge calculation, ensuring data freshness.

⚡ Technical Features

  • Dynamic Surge Algorithm: Real-time Rider-to-Driver ratio calculation with tiered multiplier logic.
  • Geospatial Pings: RESTful endpoints for real-time location check-ins.
  • Live Dashboard: Interactive Leaflet.js map visualizing surge "heatmaps" in the Nairobi CBD.
  • Swarm Simulator: A multi-threaded simulation tool that pings the engine with 50+ concurrent "moving" drivers.

📊 API Documentation

** Endpoint - Method - Description :**

  • / - GET - Interactive Live Map Dashboard
  • /surge - GET - Returns cell ID, counts, and price multiplier
  • /checkin - POST - Updates presence for a specific lat/lng Live Dashboard

🚀 Quick Start

1. Prerequisites

  • Go 1.21+
  • Redis (running on localhost:6379)

2. Run the Engine

go run cmd/api/main.go
go run simulate.go

About

A high-concurrency geospatial pricing engine built in Go. Leverages Uber's H3 discrete global grid system and Redis-backed state management to calculate real-time supply/demand surges in sub-millisecond latencies.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors