# avinashthula17/rapidride-app architecture

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

- Interactive diagram: https://gitdiagram.com/avinashthula17/rapidride-app
- Repository: https://github.com/avinashthula17/rapidride-app

## Overview

RapidRide is a web ride-hailing platform: riders book trips, drivers accept and track them, while the backend manages identity, rides, support, and live connections. A separate FastAPI service provides fare, ETA, geocoding, and asynchronous ML tasks. The graph preserves those documented capabilities, but frontend-to-API and some real-time event flows are only weakly evidenced in the supplied excerpts, so those links are marked unverified. Build, maintenance, and test scripts are omitted.

Main entry points: [`backend/index.js`](https://github.com/avinashthula17/rapidride-app/blob/main/backend/index.js) (Express server), [`fastapi/app/main.py`](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/main.py) (FastAPI service), [`fastapi/app/tasks/tasks.py`](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/tasks/tasks.py) (Background tasks), [`backend/routes/auth.js`](https://github.com/avinashthula17/rapidride-app/blob/main/backend/routes/auth.js) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_rider_ui["Rider app<br/>[app.js]"]
  node_driver_ui["Driver app<br/>[driver.js]"]
  node_rider_live["Rider live updates<br/>[socket.js]"]
  node_driver_live["Driver live updates<br/>[driver_socket.js]"]
end

subgraph group_core["Ride platform"]
  node_backend["Express server<br/>[index.js]"]
  node_auth_routes["Authentication<br/>[auth.js]"]
  node_ride_routes["Ride operations<br/>[rides.js]"]
  node_support["Support chat<br/>[support.js]"]
  node_socket_runtime["Live ride sockets<br/>[index.js]"]
end

subgraph group_ml["ML services"]
  node_fastapi["FastAPI service<br/>[main.py]"]
  node_fare_api["Fare API<br/>[fare.py]"]
  node_eta_api["ETA API<br/>[eta.py]"]
  node_geo_api["Geocoding API<br/>[geo.py]"]
  node_tasks_api["Async task API<br/>[tasks.py]"]
  node_eta_service["ETA prediction<br/>[eta_service.py]"]
  node_fare_service["Fare calculation<br/>[fare_service.py]"]
  node_geo_service["Geocoding service<br/>[geo_service.py]"]
  node_celery_tasks["Background tasks<br/>[tasks.py]"]
  node_model_infer["Model inference<br/>[infer.py]"]
  node_model_train["Model training<br/>[trainer.py]"]
end

subgraph group_infra["Shared infrastructure"]
  node_user_model[("User records<br/>[user.js]")]
  node_ride_model[("Ride records<br/>[ride.js]")]
  node_firebase_auth["Firebase auth<br/>[firebase.js]"]
  node_redis_cache[("Redis cache<br/>[redis_client.py]")]
end

node_rider(("Rider"))
node_driver(("Driver"))
node_rabbitmq["RabbitMQ"]
node_mongodb[("MongoDB")]

node_rider -.->|"uses"| node_rider_ui
node_driver -.->|"uses"| node_driver_ui
node_rider_ui -.->|"requests rides"| node_backend
node_driver_ui -.->|"manages rides"| node_backend
node_rider_live -.->|"connects to"| node_socket_runtime
node_driver_live -.->|"connects to"| node_socket_runtime
node_backend -->|"mounts"| node_auth_routes
node_backend -->|"mounts"| node_ride_routes
node_backend -->|"mounts"| node_support
node_backend -->|"serves sockets"| node_socket_runtime
node_auth_routes -->|"reads and writes"| node_user_model
node_auth_routes -->|"verifies identity"| node_firebase_auth
node_auth_routes -.->|"persists users"| node_mongodb
node_ride_routes -->|"manages rides"| node_ride_model
node_ride_routes -->|"looks up users"| node_user_model
node_ride_routes -.->|"persists rides"| node_mongodb
node_support -->|"looks up users"| node_user_model
node_backend -->|"checks health"| node_fastapi
node_backend -.->|"checks health"| node_redis_cache
node_fastapi -->|"registers"| node_fare_api
node_fastapi -->|"registers"| node_eta_api
node_fastapi -->|"registers"| node_geo_api
node_fastapi -->|"registers"| node_tasks_api
node_eta_api -->|"predicts with"| node_eta_service
node_eta_api -->|"queues work"| node_celery_tasks
node_fare_api -->|"calculates with"| node_fare_service
node_geo_api -->|"resolves with"| node_geo_service
node_tasks_api -->|"dispatches"| node_celery_tasks
node_eta_service -->|"caches predictions"| node_redis_cache
node_fare_service -->|"caches fares"| node_redis_cache
node_geo_service -->|"uses cache"| node_redis_cache
node_eta_service -->|"loads and predicts"| node_model_infer
node_celery_tasks -->|"trains model"| node_model_train
node_celery_tasks -->|"runs predictions"| node_eta_service
node_fastapi -->|"checks connection"| node_rabbitmq
node_celery_tasks -.->|"queues jobs"| node_rabbitmq

click node_rider_ui "https://github.com/avinashthula17/rapidride-app/blob/main/frontend/rider/js/app.js"
click node_driver_ui "https://github.com/avinashthula17/rapidride-app/blob/main/frontend/driver/js/driver.js"
click node_rider_live "https://github.com/avinashthula17/rapidride-app/blob/main/frontend/rider/js/socket.js"
click node_driver_live "https://github.com/avinashthula17/rapidride-app/blob/main/frontend/driver/js/driver_socket.js"
click node_backend "https://github.com/avinashthula17/rapidride-app/blob/main/backend/index.js"
click node_auth_routes "https://github.com/avinashthula17/rapidride-app/blob/main/backend/routes/auth.js"
click node_ride_routes "https://github.com/avinashthula17/rapidride-app/blob/main/backend/routes/rides.js"
click node_support "https://github.com/avinashthula17/rapidride-app/blob/main/backend/routes/support.js"
click node_socket_runtime "https://github.com/avinashthula17/rapidride-app/blob/main/backend/index.js"
click node_user_model "https://github.com/avinashthula17/rapidride-app/blob/main/backend/models/user.js"
click node_ride_model "https://github.com/avinashthula17/rapidride-app/blob/main/backend/models/ride.js"
click node_firebase_auth "https://github.com/avinashthula17/rapidride-app/blob/main/backend/config/firebase.js"
click node_fastapi "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/main.py"
click node_fare_api "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/api/fare.py"
click node_eta_api "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/api/eta.py"
click node_geo_api "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/api/geo.py"
click node_tasks_api "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/api/tasks.py"
click node_eta_service "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/services/eta_service.py"
click node_fare_service "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/services/fare_service.py"
click node_geo_service "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/services/geo_service.py"
click node_celery_tasks "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/tasks/tasks.py"
click node_model_infer "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/models/infer.py"
click node_model_train "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/models/trainer.py"
click node_redis_cache "https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/utils/redis_client.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_ui,node_driver_ui,node_rider_live,node_driver_live toneBlue
class node_backend,node_auth_routes,node_ride_routes,node_support,node_socket_runtime,node_mongodb toneAmber
class node_fastapi,node_fare_api,node_eta_api,node_geo_api,node_tasks_api,node_eta_service,node_fare_service,node_geo_service,node_celery_tasks,node_model_infer,node_model_train toneMint
class node_user_model,node_ride_model,node_firebase_auth,node_redis_cache toneRose
class node_rider,node_driver,node_rabbitmq toneIndigo
```

## Components

### Web experience

- [Rider app](https://github.com/avinashthula17/rapidride-app/blob/main/frontend/rider/js/app.js): `frontend/rider/js/app.js`
- [Driver app](https://github.com/avinashthula17/rapidride-app/blob/main/frontend/driver/js/driver.js): `frontend/driver/js/driver.js`
- [Rider live updates](https://github.com/avinashthula17/rapidride-app/blob/main/frontend/rider/js/socket.js): `frontend/rider/js/socket.js`
- [Driver live updates](https://github.com/avinashthula17/rapidride-app/blob/main/frontend/driver/js/driver_socket.js): `frontend/driver/js/driver_socket.js`

### Ride platform

- [Express server](https://github.com/avinashthula17/rapidride-app/blob/main/backend/index.js): `backend/index.js`
- [Authentication](https://github.com/avinashthula17/rapidride-app/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Ride operations](https://github.com/avinashthula17/rapidride-app/blob/main/backend/routes/rides.js): `backend/routes/rides.js`
- [Support chat](https://github.com/avinashthula17/rapidride-app/blob/main/backend/routes/support.js): `backend/routes/support.js`
- [Live ride sockets](https://github.com/avinashthula17/rapidride-app/blob/main/backend/index.js): `backend/index.js`

### ML services

- [FastAPI service](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/main.py): `fastapi/app/main.py`
- [Fare API](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/api/fare.py): `fastapi/app/api/fare.py`
- [ETA API](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/api/eta.py): `fastapi/app/api/eta.py`
- [Geocoding API](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/api/geo.py): `fastapi/app/api/geo.py`
- [Async task API](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/api/tasks.py): `fastapi/app/api/tasks.py`
- [ETA prediction](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/services/eta_service.py): `fastapi/app/services/eta_service.py`
- [Fare calculation](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/services/fare_service.py): `fastapi/app/services/fare_service.py`
- [Geocoding service](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/services/geo_service.py): `fastapi/app/services/geo_service.py`
- [Background tasks](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/tasks/tasks.py): `fastapi/app/tasks/tasks.py`
- [Model inference](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/models/infer.py): `fastapi/app/models/infer.py`
- [Model training](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/models/trainer.py): `fastapi/app/models/trainer.py`

### Shared infrastructure

- [User records](https://github.com/avinashthula17/rapidride-app/blob/main/backend/models/user.js): `backend/models/user.js`
- [Ride records](https://github.com/avinashthula17/rapidride-app/blob/main/backend/models/ride.js): `backend/models/ride.js`
- [Firebase auth](https://github.com/avinashthula17/rapidride-app/blob/main/backend/config/firebase.js): `backend/config/firebase.js`
- [Redis cache](https://github.com/avinashthula17/rapidride-app/blob/main/fastapi/app/utils/redis_client.py): `fastapi/app/utils/redis_client.py`

### Other components

- **Rider**
- **Driver**
- **RabbitMQ**
- **MongoDB**

## Connections

- Rider → Rider app: uses
- Driver → Driver app: uses
- Rider app → Express server: requests rides
- Driver app → Express server: manages rides
- Rider live updates → Live ride sockets: connects to
- Driver live updates → Live ride sockets: connects to
- Express server → Authentication: mounts (evidence: `backend/index.js`)
- Express server → Ride operations: mounts (evidence: `backend/index.js`)
- Express server → Support chat: mounts (evidence: `backend/index.js`)
- Express server → Live ride sockets: serves sockets (evidence: `backend/index.js`)
- Authentication → User records: reads and writes (evidence: `backend/routes/auth.js`)
- Authentication → Firebase auth: verifies identity (evidence: `backend/routes/auth.js`)
- Authentication → MongoDB: persists users
- Ride operations → Ride records: manages rides (evidence: `backend/routes/rides.js`)
- Ride operations → User records: looks up users (evidence: `backend/routes/rides.js`)
- Ride operations → MongoDB: persists rides
- Support chat → User records: looks up users (evidence: `backend/routes/support.js`)
- Express server → FastAPI service: checks health (evidence: `backend/index.js`)
- Express server → Redis cache: checks health
- FastAPI service → Fare API: registers (evidence: `fastapi/app/main.py`)
- FastAPI service → ETA API: registers (evidence: `fastapi/app/main.py`)
- FastAPI service → Geocoding API: registers (evidence: `fastapi/app/main.py`)
- FastAPI service → Async task API: registers (evidence: `fastapi/app/main.py`)
- ETA API → ETA prediction: predicts with (evidence: `fastapi/app/api/eta.py`)
- ETA API → Background tasks: queues work (evidence: `fastapi/app/api/eta.py`)
- Fare API → Fare calculation: calculates with (evidence: `fastapi/app/api/fare.py`)
- Geocoding API → Geocoding service: resolves with (evidence: `fastapi/app/api/geo.py`)
- Async task API → Background tasks: dispatches (evidence: `fastapi/app/api/tasks.py`)
- ETA prediction → Redis cache: caches predictions (evidence: `fastapi/app/services/eta_service.py`)
- Fare calculation → Redis cache: caches fares (evidence: `fastapi/app/services/fare_service.py`)
- Geocoding service → Redis cache: uses cache (evidence: `fastapi/app/services/geo_service.py`)
- ETA prediction → Model inference: loads and predicts (evidence: `fastapi/app/services/eta_service.py`)
- Background tasks → Model training: trains model (evidence: `fastapi/app/tasks/tasks.py`)
- Background tasks → ETA prediction: runs predictions (evidence: `fastapi/app/tasks/tasks.py`)
- FastAPI service → RabbitMQ: checks connection (evidence: `fastapi/app/main.py`)
- Background tasks → RabbitMQ: queues jobs
