# akankshagulekar/ridesharingsystem architecture

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

- Interactive diagram: https://gitdiagram.com/akankshagulekar/ridesharingsystem
- Repository: https://github.com/akankshagulekar/ridesharingsystem

## Overview

This is a C++ ride-sharing backend simulation. The main workflow is a client sending REST requests to register or add wallet funds, book a ride, and advance its lifecycle; booking finds a route and driver, estimates time and fare, then persists the ride and payment state. The README documents additional authentication, safety filtering, escrow-style payment, and admin reporting. Service internals are partly unsampled, so links beyond the shown calls are included only where the README documents them.

Main entry points: [`src/main.cpp`](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/main.cpp) (REST routes), [`src/RideSystem.cpp`](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp) (Booking and matching), [`src/Storage.cpp`](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/Storage.cpp) (File persistence), [`src/Graph.cpp`](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/Graph.cpp) (Road graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_http["REST routes<br/>[main.cpp]"]
end

subgraph group_service["Ride services"]
  node_accounts["Accounts and wallet<br/>[RideSystem.cpp]"]
  node_booking["Booking and matching<br/>[RideSystem.cpp]"]
  node_lifecycle["Ride lifecycle<br/>[RideSystem.cpp]"]
  node_reports["Admin reports<br/>[RideSystem.cpp]"]
end

subgraph group_domain["Routing and pricing"]
  node_graph["Road graph<br/>[Graph.cpp]"]
  node_mapdata["Map file<br/>[map.txt]"]
  node_fare["Fare strategies<br/>[Fare.h]"]
  node_eta["ETA calculator<br/>[Eta.h]"]
end

subgraph group_state["Domain and persistence"]
  node_models["Ride and payment models<br/>[models.h]"]
  node_storage["File persistence<br/>[Storage.cpp]"]
  node_storeddata[("Persisted records")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_http
node_http -->|"calls account APIs"| node_accounts
node_http -->|"calls booking API"| node_booking
node_http -->|"calls ride APIs"| node_lifecycle
node_http -->|"requests report"| node_reports
node_http -->|"loads map"| node_graph
node_booking -->|"finds routes"| node_graph
node_booking -->|"selects fare"| node_fare
node_booking -->|"calculates ETA"| node_eta
node_graph -->|"loads network"| node_mapdata
node_booking -->|"creates ride records"| node_models
node_lifecycle -->|"updates ride payments"| node_models
node_accounts -->|"persists changes"| node_storage
node_booking -->|"persists booking"| node_storage
node_lifecycle -->|"persists transitions"| node_storage
node_reports -->|"summarizes records"| node_models
node_storage -->|"reads and writes"| node_storeddata

click node_http "https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/main.cpp"
click node_accounts "https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp"
click node_booking "https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp"
click node_lifecycle "https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp"
click node_reports "https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp"
click node_graph "https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/Graph.cpp"
click node_mapdata "https://github.com/akankshagulekar/ridesharingsystem/blob/main/data/map.txt"
click node_fare "https://github.com/akankshagulekar/ridesharingsystem/blob/main/include/Fare.h"
click node_eta "https://github.com/akankshagulekar/ridesharingsystem/blob/main/include/Eta.h"
click node_models "https://github.com/akankshagulekar/ridesharingsystem/blob/main/include/models.h"
click node_storage "https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/Storage.cpp"
click node_storeddata "https://github.com/akankshagulekar/ridesharingsystem/tree/main/data/store"

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_http,node_client toneBlue
class node_accounts,node_booking,node_lifecycle,node_reports toneAmber
class node_graph,node_mapdata,node_fare,node_eta toneMint
class node_models,node_storage,node_storeddata toneRose
```

## Components

### API and access

- [REST routes](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/main.cpp): `src/main.cpp`

### Ride services

- [Accounts and wallet](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp): `src/RideSystem.cpp`
- [Booking and matching](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp): `src/RideSystem.cpp`
- [Ride lifecycle](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp): `src/RideSystem.cpp`
- [Admin reports](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/RideSystem.cpp): `src/RideSystem.cpp`

### Routing and pricing

- [Road graph](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/Graph.cpp): `src/Graph.cpp`
- [Map file](https://github.com/akankshagulekar/ridesharingsystem/blob/main/data/map.txt): `data/map.txt`
- [Fare strategies](https://github.com/akankshagulekar/ridesharingsystem/blob/main/include/Fare.h): `include/Fare.h`
- [ETA calculator](https://github.com/akankshagulekar/ridesharingsystem/blob/main/include/Eta.h): `include/Eta.h`

### Domain and persistence

- [Ride and payment models](https://github.com/akankshagulekar/ridesharingsystem/blob/main/include/models.h): `include/models.h`
- [File persistence](https://github.com/akankshagulekar/ridesharingsystem/blob/main/src/Storage.cpp): `src/Storage.cpp`
- [Persisted records](https://github.com/akankshagulekar/ridesharingsystem/tree/main/data/store): `data/store`

### Other components

- **API client**

## Connections

- API client → REST routes: sends requests (evidence: `README.md`)
- REST routes → Accounts and wallet: calls account APIs (evidence: `src/main.cpp`)
- REST routes → Booking and matching: calls booking API (evidence: `src/main.cpp`)
- REST routes → Ride lifecycle: calls ride APIs (evidence: `src/main.cpp`)
- REST routes → Admin reports: requests report (evidence: `src/main.cpp`)
- REST routes → Road graph: loads map (evidence: `src/main.cpp`)
- Booking and matching → Road graph: finds routes (evidence: `README.md`)
- Booking and matching → Fare strategies: selects fare (evidence: `README.md`)
- Booking and matching → ETA calculator: calculates ETA (evidence: `README.md`)
- Road graph → Map file: loads network (evidence: `src/Graph.cpp`)
- Booking and matching → Ride and payment models: creates ride records (evidence: `README.md`)
- Ride lifecycle → Ride and payment models: updates ride payments (evidence: `README.md`)
- Accounts and wallet → File persistence: persists changes (evidence: `README.md`)
- Booking and matching → File persistence: persists booking (evidence: `README.md`)
- Ride lifecycle → File persistence: persists transitions (evidence: `README.md`)
- Admin reports → Ride and payment models: summarizes records (evidence: `README.md`)
- File persistence → Persisted records: reads and writes (evidence: `src/Storage.cpp`)
