You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Distributed ride-sharing platform engineered for hyperscale. Built with Go, gRPC, CockroachDB, Kafka, and Kubernetes — following Google SRE and Uber-style microservices patterns.
Architecture
graph TD
classDef gateway fill:#1a1a2e,stroke:#e94560,color:#fff
classDef svc fill:#16213e,stroke:#0f3460,color:#fff
classDef data fill:#0f3460,stroke:#53354a,color:#fff
classDef obs fill:#1b1b2f,stroke:#f1c40f,color:#f1c40f
classDef client fill:#e94560,stroke:#e94560,color:#fff
Client([📱 Mobile & Web Clients]):::client -->|HTTPS / REST| LB
subgraph K8s ["☸ Kubernetes Cluster — Auto-Scaling via HPA"]
LB[Load Balancer / Ingress]:::gateway -->|Route| GW
subgraph BFF ["API Gateway — BFF Pattern"]
GW["Gateway :8080<br/>JWT Auth · Rate Limiter · CORS · Circuit Breaker"]:::gateway
end
subgraph Services ["gRPC Microservices"]
Auth["Auth<br/>bcrypt · Token Pairs · Lockout"]:::svc
User["User<br/>Profiles · Availability"]:::svc
Ride["Ride<br/>Matching · Surge Pricing"]:::svc
Location["Location<br/>PostGIS · Geofencing"]:::svc
Payment["Payment<br/>Idempotent Charges"]:::svc
end
GW -->|gRPC| Auth
GW -->|gRPC| User
GW -->|gRPC| Ride
GW -->|gRPC| Location
GW -->|gRPC| Payment
subgraph Data ["Distributed Data Plane"]
DB[(CockroachDB<br/>Distributed SQL)]:::data
Cache[(Redis<br/>Locks · Rate Limits)]:::data
MQ[(Kafka<br/>Event Streaming)]:::data
end
Auth & User & Ride & Location & Payment --> DB
Ride & Location --> Cache
Ride & Location -->|Produce| MQ
MQ -->|Consume| GW
subgraph Observe ["Observability — Google SRE Stack"]
direction LR
Prom[Prometheus<br/>Metrics & Alerts]:::obs
Trace[Jaeger<br/>Distributed Tracing]:::obs
Log[Loki + Promtail<br/>Structured Logs]:::obs
Dash[Grafana<br/>SLO Dashboards]:::obs
end
GW -.->|OpenTelemetry| Trace
Services -.->|Scrape| Prom
Services -.->|JSON Logs| Log
Dash --- Prom & Trace & Log
end
GW -->|WebSocket| Client
Loading
Quick Start
# Deploy full stack to local Kubernetes (Kind)
./scripts/deploy-cluster.sh
# Expose the gateway
kubectl port-forward -n rideshare svc/gateway 8080:8080 &# Verify
curl http://localhost:8080/health
Distributed k6 load test designed for 1M req/s inside the Kubernetes cluster.
# Run distributed load test (50 k6 pods × 20K req/s each)
./scripts/run-loadtest.sh
# Run local smoke test
./scripts/run-loadtest.sh --local
SLO Target
Threshold
p95 Latency
< 500 ms
p99 Latency
< 1.5 s
Error Rate
< 0.1%
Benchmarks
Hot-path function performance on Apple M1 Pro (go test -bench):
Function
ns/op
ops/sec
Allocations
Haversine (geo distance)
39 ns
~25M/s
0 allocs
EstimateFare (pricing)
0.39 ns
~2.5B/s
0 allocs
EstimateETA
0.31 ns
~3.2B/s
0 allocs
GenerateToken (JWT sign)
2,381 ns
~420K/s
42 allocs
ValidateToken (JWT verify)
4,033 ns
~248K/s
57 allocs
GenerateTokenPair (access + refresh)
5,185 ns
~193K/s
91 allocs
# Reproduce
go test -bench=. -benchmem ./pkg/geo/ ./pkg/jwt/
Development
# Full stack on local Kubernetes (Kind)
./scripts/deploy-cluster.sh
# Port-forward observability
kubectl port-forward -n rideshare svc/grafana 3000:3000 &
kubectl port-forward -n rideshare svc/jaeger 16686:16686 &# Unit tests
go test ./... -count=1
# Build a single service
go build -o bin/gateway ./cmd/gateway
Configuration
Variable
Default
Description
SERVER_PORT
8080
HTTP / gRPC listen port
DATABASE_URL
—
CockroachDB connection string
REDIS_ADDR
localhost:6379
Redis address
KAFKA_BROKERS
localhost:9092
Kafka broker list
JWT_SECRET
—
HMAC signing key
JWT_EXPIRATION
24h
Access token TTL
RATE_LIMIT
100
Global req/s limit
RATE_BURST
200
Burst allowance
OTEL_EXPORTER_OTLP_ENDPOINT
localhost:4318
Jaeger OTLP endpoint
OTEL_ENABLED
true
Toggle distributed tracing
LOG_FORMAT
console
json for production
About
Distributed ride-sharing platform — Go, gRPC, CockroachDB, Kafka, Kubernetes. Google SRE observability, auto-scaling HPA, and distributed load testing at 1M req/s.