# wncc/hello-foss-26_uberclone architecture

> Architecture diagram of the GitHub repository wncc/hello-foss-26_uberclone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wncc/hello-foss-26_uberclone
- Repository: https://github.com/wncc/hello-foss-26_uberclone

## Overview

UberClone is a ride-hailing product: riders choose a route and vehicle, book and track a ride; drivers register, accept requests, navigate, start with a PIN, and complete trips. The backend handles accounts, ride operations, dispatch and live updates, supported by matching and a Mumbai-road routing engine. The README documents these user journeys and routing capabilities; several implementation links below rely on that documentation or are left unverified because their source was not sampled.

Main entry points: [`mobile/src/lib/api.ts`](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/lib/api.ts) (HTTP client), [`backend/app/main.py`](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/main.py) (FastAPI endpoints), [`mobile/src/app/rider/index.tsx`](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/rider/index.tsx) (Rider booking), [`backend/app/services/rides.py`](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/rides.py) (Ride lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Rider and driver apps"]
  node_rider["Rider booking<br/>[index.tsx]"]
  node_rider_trip["Ride tracking<br/>[&#91;id&#93;.tsx]"]
  node_driver["Driver operations<br/>[index.tsx]"]
  node_driver_trip["Driver trip<br/>[&#91;id&#93;.tsx]"]
  node_mobile_session["App session<br/>[session.tsx]"]
  node_mobile_api["HTTP client<br/>[api.ts]"]
  node_mobile_socket["Live socket<br/>[socket.ts]"]
  node_mobile_map["Ride map<br/>[RideMap.tsx]"]
end

subgraph group_backend["Backend services"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_auth["OTP authentication<br/>[auth.py]"]
  node_ride_service["Ride lifecycle<br/>[rides.py]"]
  node_dispatch["Dispatch loop<br/>[dispatch.py]"]
  node_pricing["Fare calculation<br/>[pricing.py]"]
  node_route_service["Trip routing service<br/>[routes.py]"]
end

subgraph group_matching["Driver matching"]
  node_matching_engine["Nearby driver matching<br/>[engine.py]"]
end

subgraph group_routing["Road routing"]
  node_osm_import["OSM road import<br/>[osm_import.py]"]
  node_road_graph["Road graph<br/>[graph.py]"]
  node_routing_engine["Route engine<br/>[engine.py]"]
  node_routing_rules["Routing rules<br/>[rule_engine.py]"]
  node_road_models["Road and vehicle models<br/>[models.py]"]
  node_routing_telemetry["Traffic telemetry<br/>[telemetry.py]"]
end

subgraph group_state["Persistence and live state"]
  node_realtime_hub["Realtime hub<br/>[realtime.py]"]
  node_database[("Application database<br/>[db.py]")]
end

node_user(("Rider or driver"))

node_user -->|"books ride"| node_rider
node_user -->|"accepts requests"| node_driver
node_rider -.->|"uses session"| node_mobile_session
node_driver -.->|"uses session"| node_mobile_session
node_mobile_session -->|"calls"| node_mobile_api
node_mobile_session -->|"configures"| node_mobile_socket
node_rider -->|"selects locations"| node_mobile_map
node_rider -.->|"requests booking"| node_mobile_api
node_driver -.->|"updates availability"| node_mobile_api
node_mobile_api -.->|"HTTP requests"| node_api
node_api -->|"registers routes"| node_auth
node_api -.->|"routes ride operations"| node_ride_service
node_api -->|"starts dispatch"| node_dispatch
node_api -->|"configures hub"| node_realtime_hub
node_auth -->|"reads and writes"| node_database
node_ride_service -.->|"persists rides"| node_database
node_ride_service -->|"calculates fare"| node_pricing
node_ride_service -.->|"requests estimates"| node_route_service
node_dispatch -.->|"assigns drivers"| node_matching_engine
node_route_service -->|"provides pickup ETA"| node_matching_engine
node_route_service -->|"routes trips"| node_routing_engine
node_route_service -->|"loads road data"| node_osm_import
node_osm_import -->|"builds graph"| node_road_graph
node_routing_engine -->|"searches graph"| node_road_graph
node_routing_engine -->|"evaluates model"| node_routing_rules
node_routing_rules -->|"evaluates edge metadata"| node_road_models
node_osm_import -->|"creates road metadata"| node_road_models
node_routing_telemetry -.->|"derives overlays"| node_routing_rules
node_mobile_socket -.->|"receives live updates"| node_realtime_hub
node_realtime_hub -.->|"sends ride events"| node_mobile_socket
node_rider_trip -.->|"loads ride"| node_mobile_api
node_driver_trip -.->|"updates trip"| node_mobile_api

click node_rider "https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/rider/index.tsx"
click node_rider_trip "https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/rider/ride/%5Bid%5D.tsx"
click node_driver "https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/driver/index.tsx"
click node_driver_trip "https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/driver/trip/%5Bid%5D.tsx"
click node_mobile_session "https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/lib/session.tsx"
click node_mobile_api "https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/lib/api.ts"
click node_mobile_socket "https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/lib/socket.ts"
click node_mobile_map "https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/components/RideMap.tsx"
click node_api "https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/main.py"
click node_auth "https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/api/auth.py"
click node_ride_service "https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/rides.py"
click node_dispatch "https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/dispatch.py"
click node_pricing "https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/pricing.py"
click node_route_service "https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/routes.py"
click node_realtime_hub "https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/realtime.py"
click node_database "https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/db.py"
click node_matching_engine "https://github.com/wncc/hello-foss-26_uberclone/blob/main/matching/engine.py"
click node_osm_import "https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/osm_import.py"
click node_road_graph "https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/graph.py"
click node_routing_engine "https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/engine.py"
click node_routing_rules "https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/rule_engine.py"
click node_road_models "https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/models.py"
click node_routing_telemetry "https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/telemetry.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rider,node_rider_trip,node_driver,node_driver_trip,node_mobile_session,node_mobile_api,node_mobile_socket,node_mobile_map toneBlue
class node_api,node_auth,node_ride_service,node_dispatch,node_pricing,node_route_service toneAmber
class node_matching_engine toneMint
class node_osm_import,node_road_graph,node_routing_engine,node_routing_rules,node_road_models,node_routing_telemetry toneRose
class node_realtime_hub,node_database,node_user toneIndigo
```

## Components

### Rider and driver apps

- [Rider booking](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/rider/index.tsx): `mobile/src/app/rider/index.tsx`
- [Ride tracking](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/rider/ride/%5Bid%5D.tsx): `mobile/src/app/rider/ride/[id].tsx`
- [Driver operations](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/driver/index.tsx): `mobile/src/app/driver/index.tsx`
- [Driver trip](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/app/driver/trip/%5Bid%5D.tsx): `mobile/src/app/driver/trip/[id].tsx`
- [App session](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/lib/session.tsx): `mobile/src/lib/session.tsx`
- [HTTP client](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/lib/api.ts): `mobile/src/lib/api.ts`
- [Live socket](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/lib/socket.ts): `mobile/src/lib/socket.ts`
- [Ride map](https://github.com/wncc/hello-foss-26_uberclone/blob/main/mobile/src/components/RideMap.tsx): `mobile/src/components/RideMap.tsx`

### Backend services

- [FastAPI endpoints](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/main.py): `backend/app/main.py`
- [OTP authentication](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Ride lifecycle](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/rides.py): `backend/app/services/rides.py`
- [Dispatch loop](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/dispatch.py): `backend/app/services/dispatch.py`
- [Fare calculation](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/pricing.py): `backend/app/services/pricing.py`
- [Trip routing service](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/routes.py): `backend/app/services/routes.py`

### Driver matching

- [Nearby driver matching](https://github.com/wncc/hello-foss-26_uberclone/blob/main/matching/engine.py): `matching/engine.py`

### Road routing

- [OSM road import](https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/osm_import.py): `routing/osm_import.py`
- [Road graph](https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/graph.py): `routing/graph.py`
- [Route engine](https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/engine.py): `routing/engine.py`
- [Routing rules](https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/rule_engine.py): `routing/rule_engine.py`
- [Road and vehicle models](https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/models.py): `routing/models.py`
- [Traffic telemetry](https://github.com/wncc/hello-foss-26_uberclone/blob/main/routing/telemetry.py): `routing/telemetry.py`

### Persistence and live state

- [Realtime hub](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/services/realtime.py): `backend/app/services/realtime.py`
- [Application database](https://github.com/wncc/hello-foss-26_uberclone/blob/main/backend/app/db.py): `backend/app/db.py`

### Other components

- **Rider or driver**

## Connections

- Rider or driver → Rider booking: books ride
- Rider or driver → Driver operations: accepts requests
- Rider booking → App session: uses session
- Driver operations → App session: uses session
- App session → HTTP client: calls (evidence: `mobile/src/lib/session.tsx`)
- App session → Live socket: configures (evidence: `mobile/src/lib/session.tsx`)
- Rider booking → Ride map: selects locations
- Rider booking → HTTP client: requests booking
- Driver operations → HTTP client: updates availability
- HTTP client → FastAPI endpoints: HTTP requests
- FastAPI endpoints → OTP authentication: registers routes (evidence: `backend/app/main.py`)
- FastAPI endpoints → Ride lifecycle: routes ride operations
- FastAPI endpoints → Dispatch loop: starts dispatch (evidence: `backend/app/main.py`)
- FastAPI endpoints → Realtime hub: configures hub (evidence: `backend/app/main.py`)
- OTP authentication → Application database: reads and writes (evidence: `backend/app/api/auth.py`)
- Ride lifecycle → Application database: persists rides
- Ride lifecycle → Fare calculation: calculates fare (evidence: `backend/app/services/rides.py`)
- Ride lifecycle → Trip routing service: requests estimates
- Dispatch loop → Nearby driver matching: assigns drivers
- Trip routing service → Nearby driver matching: provides pickup ETA (evidence: `backend/app/services/routes.py`)
- Trip routing service → Route engine: routes trips (evidence: `backend/app/services/routes.py`)
- Trip routing service → OSM road import: loads road data (evidence: `backend/app/services/routes.py`)
- OSM road import → Road graph: builds graph (evidence: `routing/osm_import.py`)
- Route engine → Road graph: searches graph (evidence: `routing/engine.py`)
- Route engine → Routing rules: evaluates model (evidence: `routing/engine.py`)
- Routing rules → Road and vehicle models: evaluates edge metadata (evidence: `routing/rule_engine.py`)
- OSM road import → Road and vehicle models: creates road metadata (evidence: `routing/osm_import.py`)
- Traffic telemetry → Routing rules: derives overlays
- Live socket → Realtime hub: receives live updates
- Realtime hub → Live socket: sends ride events
- Ride tracking → HTTP client: loads ride
- Driver trip → HTTP client: updates trip
