How asitharamesh/lyft-clone works
This repository is a ride-sharing and food-delivery simulation, with rider and driver web apps backed by Flask REST and Socket.IO. The main journey is a rider request, route/fare calculation, nearby-driver matching and private offer, acceptance and persisted trip state, then room-scoped updates from the driver or selected simulator. Food ordering, authentication, admin operations, and health checks are separate product capabilities. The graph uses documented flows and visible imports/calls; some socket dispatch details and simulator wiring are described by the README rather than sampled implementation.
Main entry points: handlers.py Socket handlers · app.py Flask REST · admin_routes.py Admin API · db.py PostgreSQL
Components 21
Web clients
- Rider app
frontend/new_map.html - Driver app
backend - Admin dashboard
frontend/admin.html
Backend interfaces
- Flask REST
backend/app.py - Authentication routes
backend/routes/auth_routes.py - Menu and fare API
backend/routes/menu_routes.py - Health API
backend/routes/health_routes.py - Admin API
backend/routes/admin_routes.py - Socket handlers
backend/sockets/handlers.py
Ride services
- Auth service
backend/services/auth_service.py - Driver matching
backend/services/matching_service.py - Ride lifecycle
backend/services/ride_service.py - Road routing
backend/services/routing_service.py - Fare pricing
backend/services/pricing_service.py - Ride simulator
backend/ride_simulation_engine.js
Persistence and realtime state
- PostgreSQL
backend/db.py - Redis state
backend/db.py - Socket.IO
backend/extensions.py - OSRM routing
Operations
- Operational statistics
backend/services/ops_stats.py
Other components
- Admin user
Connections 33
- Flask REST → Authentication routes: registers routes
backend/app.py - Flask REST → Menu and fare API: registers routes
backend/app.py - Flask REST → Health API: registers routes
backend/app.py - Flask REST → Admin API: registers routes
backend/app.py - Flask REST → Socket.IO: initializes
backend/app.py - Rider app → Flask REST: requests API
README.md - Driver app → Socket handlers: sends events
README.md - Rider app → Socket handlers: requests rides
README.md - Authentication routes → Auth service: hashes and issues tokens
backend/routes/auth_routes.py - Authentication routes → PostgreSQL: reads and writes accounts
backend/routes/auth_routes.py - Menu and fare API → PostgreSQL: reads menus
backend/routes/menu_routes.py - Menu and fare API → Road routing: calculates routes
backend/routes/menu_routes.py - Menu and fare API → Fare pricing: builds fare
backend/routes/menu_routes.py - Socket handlers → Driver matching: finds drivers
backend/sockets/handlers.py - Socket handlers → Ride lifecycle: manages ride state
backend/sockets/handlers.py - Socket handlers → Road routing: calculates trip routes
backend/sockets/handlers.py - Socket handlers → Fare pricing: calculates fares
backend/sockets/handlers.py - Driver matching → PostgreSQL: reads driver profiles
backend/services/matching_service.py - Driver matching → Redis state: queries GEO index
backend/services/matching_service.py - Ride lifecycle → PostgreSQL: persists lifecycle
backend/services/ride_service.py - Road routing → OSRM routing: requests road routes
backend/services/routing_service.py - Road routing → Road routing: falls back to haversine
backend/services/routing_service.py - Socket handlers → Socket.IO: emits room updates
backend/sockets/handlers.py - Socket.IO → Redis state: publishes events
backend/extensions.py - Socket handlers → Ride simulator: starts simulation
README.md - Ride simulator → Socket handlers: reports trip updates
README.md - Health API → PostgreSQL: checks readiness
backend/db.py - Admin dashboard → Admin API: requests operations data
backend/routes/admin_routes.py - Admin user → Admin API: views operations
README.md - Admin API → PostgreSQL: reads operations data
backend/routes/admin_routes.py - Admin API → Redis state: reads driver state
backend/routes/admin_routes.py - Admin API → Operational statistics: reads counters
backend/routes/admin_routes.py - Operational statistics → Redis state: stores counters
backend/services/ops_stats.py