Executive Summary

In the high-demand ride-hailing sector, system latency, data integrity, and real-time reliability dictate user trust and platform success. This case study highlights the engineering behind Anvo Autos—a resilient, high-concurrency backend engine built using Node.js, Fastify, PostgreSQL (PostGIS), Redis, and Socket.IO.

The platform guarantees 100% financial accuracy via double-entry ledger wallets, thwarts fare manipulation using automated PostGIS route deviation alerts, and secures passenger safety through zero-PII (Personally Identifiable Information) live trip tracking links.

Decorative shape

Project Challenges

Challenge

1

High-Concurrency Driver Availability & Lifecycle: Managing thousands of drivers transitioning between Online, Offline, On Trip, and Paused states simultaneously creates extreme database lock contention. Stale availability states result in matching inefficiencies and drop-offs.

Challenge 1
Challenge

2

Sub-Second GPS Ingestion & Network Jitter: Processing GPS coordinates emitted by driver devices every few seconds strains database write capacities, while packet loss causes lagging vehicle markers on client maps.

Challenge 2
Challenge

3

Financial Race Conditions & Transaction Integrity: During peak surge hours, concurrent wallet debits, promo applications, and trip cancellations trigger race conditions, causing balance mismatches and double-spending.

Challenge 3
Challenge

4

Fare Fraud & Route Deviation Detection: Detecting when a driver intentionally takes a longer, inefficient route to inflate travel fares requires live, continuous spatial tracking without overloading server memory.

Challenge 4
Challenge

5

Data Privacy & Safe Trip Sharing: Riders need the ability to share live route tracking links with family. However, exposing internal database IDs or raw APIs risks leaking PII (Personally Identifiable Information).

Challenge 5
Challenge

6

Fault-Tolerant Scheduled Rides: Delayed ride bookings must dispatch at the exact minute requested. System restarts or temporary Redis outages cannot be allowed to cause missed bookings.

Challenge 6
Our Solutions Illustration MobileOur Solutions Illustration Desktop

Our Solutions

1. Robust Driver Lifecycle State Machine
  • Enforced strict, backend-controlled transitions (OFFLINE ↔ AVAILABLE ↔ ON_TRIP).
  • A background cron job (DriverHealthJob) offlines inactive drivers after 30 seconds of heartbeat loss.
2. Redis GEO & GPS Smoothing
  • Cached driver locations in memory using Redis GEO for sub-second updates.
  • Implemented a GPS filter that ignores insignificant movement (<10m) to minimize database write-overhead.
3. Immutable Double-Entry Ledger Wallet
  • Configured a transaction ledger (wallet_ledger) utilizing Row-Level Locking (SELECT FOR UPDATE) within atomic database transactions.
  • Guarantees negative balance protection and prevents race conditions.
4. PostGIS LineString Deviation Tracking
  • Decoded planned Google Routes polylines into PostGIS LineString geometry in PostgreSQL.
  • Used ST_Distance to compare live driver GPS points against the route, triggering Socket.IO deviation warnings if they stray >500m.
5. Argon2 OTP-Secured Trip Validation
  • Secured the trip pickup phase by requiring drivers to input a 4-digit OTP.
  • Verified against an Argon2 hash in the database, locking verification after 3 failed attempts to block brute-force attacks.
6. High-Entropy, Zero-PII Trip Sharing
  • Developed a tokenized sharing link (64-character hex token).
  • The public endpoint filters out sensitive details, streaming progress to read-only Socket.IO rooms.
7. Resilient Scheduled Ride Queuing
  • Automated booking dispatches with BullMQ workers on Redis.
  • Built a secondary local fallback database scheduler to guarantee execution during temporary Redis outages.
Decorative pattern

Technologies Used

Technologies illustration
Runtime & Framework
01
  • Node.js
  • Fastify
  • TypeScript
Geospatial & ORM
02
  • PostgreSQL + PostGIS
  • Prisma ORM
Caching & Real-Time
03
  • Redis GEO
  • Socket.IO
  • BullMQ
Security & Observability
04
  • Argon2
  • MSG91
  • Prometheus

Impact On Business

0% Ledger Discrepancies: The double-entry ledger architecture completely eliminated race conditions, duplicate promo redemptions, and wallet balance errors.

45% Map API Cost Reduction: Caching route geometry in Redis and applying throttling logic successfully decreased recurring Google Maps API costs.

99.9% Booking Dispatch Rate: The combination of BullMQ workers and local database fallbacks ensured scheduled trips were processed without failure.

Zero Passenger Data Leaks: Secure, high-entropy tokenized links enabled anonymous web tracking without exposing internal IDs, usernames, or phone numbers.

Proactive Fraud Mitigation: Real-time route deviation alerts successfully flagged unauthorized route expansions, reducing fare disputes by 30%.

Anvo Autos Business Impact

Conclusion

The architecture of Anvo Autos demonstrates that high-concurrency web applications do not need to sacrifice financial accuracy or user privacy for real-time responsiveness. By offloading hot-path GPS data to Redis GEO, utilizing PostGIS for localized spatial logic, and securing transactions with immutable ledgering and row-level locking, the platform stands as a benchmark for modern, scalable, and secure ride-hailing engines.

Case Study

Need a Website, Web Application, Customized CRM Software or a Mobile App for your Business?

LET'S TALK
Default Title | Technology