# thevirtualkrishnaaa/routewise architecture

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

- Interactive diagram: https://gitdiagram.com/thevirtualkrishnaaa/routewise
- Repository: https://github.com/thevirtualkrishnaaa/routewise
- Video tour (about a minute): https://gitdiagram.com/thevirtualkrishnaaa/routewise/video

## Overview

RouteWise is a cross-platform UK route-planning and navigation app focused on showing road charges before and during a journey. Drivers enter destinations, compare routes and costs, then navigate with live guidance and charge warnings; they can also manage vehicles, payment reminders, and journey history. The README documents the main app capabilities, while sampled backend and iOS sources confirm callable-function validation, Maps proxying, and native Firebase bridging. Most shared runtime implementation was not sampled, so undocumented internal call relationships are omitted.

Main entry points: [`shared/src/commonMain/kotlin/com/example/ui/RouteWiseApp.kt`](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/RouteWiseApp.kt) (RouteWise app), [`shared/src/commonMain/kotlin/com/example/ui/screens/RoutePlannerScreen.kt`](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/RoutePlannerScreen.kt) (Route planner), [`functions/src/index.ts`](https://github.com/thevirtualkrishnaaa/routewise/blob/main/functions/src/index.ts) (Callable backend), [`shared/src/commonMain/kotlin/com/example/ui/screens/LiveNavigationScreen.kt`](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/LiveNavigationScreen.kt) (Live navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_journey["Planning and navigation"]
  node_app["RouteWise app<br/>[RouteWiseApp.kt]"]
  node_planner["Route planner"]
  node_search["Place search"]
  node_routing["Route planning"]
  node_mapsclient["Maps client"]
  node_live["Live navigation"]
  node_navengine["Navigation engine"]
  node_location["GPS tracking<br/>[LocationTracker.kt]"]
end

subgraph group_charges["Road charges"]
  node_map["Interactive charge map<br/>[ChargeMapScreen.kt]"]
  node_zones["UK charge schemes"]
  node_chargecalc["Route charge calculator"]
  node_detour["Charge avoidance"]
end

subgraph group_account["Persistence and account"]
  node_vehicles["Vehicle profiles<br/>[VehicleScreens.kt]"]
  node_payment["Payment reminders"]
  node_history["Journey history"]
  node_repository["App repository"]
  node_localdb[("Local database")]
  node_nativebridge["iOS Firebase bridge<br/>[NativeBridge.swift]"]
end

subgraph group_backend["Cloud services"]
  node_functions["Callable backend<br/>[index.ts]"]
  node_validation["Request validation<br/>[validate.ts]"]
end

node_driver(("Driver"))
node_googlemaps["Google Maps APIs"]
node_firestore[("Firebase Firestore")]
node_gps["Device GPS"]

node_driver -->|"uses"| node_app
node_app -->|"opens planner"| node_planner
node_planner -->|"searches places"| node_search
node_planner -->|"compares routes"| node_routing
node_planner -->|"shows fees"| node_chargecalc
node_planner -->|"avoids charges"| node_detour
node_routing -.->|"requests routing"| node_mapsclient
node_mapsclient -.->|"calls functions"| node_functions
node_functions -->|"validates requests"| node_validation
node_functions -->|"requests routes and places"| node_googlemaps
node_app -->|"shows charge map"| node_map
node_chargecalc -->|"applies scheme rules"| node_zones
node_app -->|"starts navigation"| node_live
node_live -->|"provides guidance"| node_navengine
node_live -->|"tracks position"| node_location
node_location -.->|"reads location"| node_gps
node_app -->|"manages vehicles"| node_vehicles
node_vehicles -->|"personalizes fees"| node_chargecalc
node_app -->|"tracks payments"| node_payment
node_app -->|"reviews journeys"| node_history
node_repository -.->|"persists locally"| node_localdb
node_nativebridge -->|"reads and writes"| node_firestore
node_nativebridge -->|"calls account deletion"| node_functions
node_functions -->|"stores feedback and deletes data"| node_firestore
node_app -.->|"uses repository"| node_repository

click node_app "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/RouteWiseApp.kt"
click node_planner "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/RoutePlannerScreen.kt"
click node_search "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/service/LocationPredictionService.kt"
click node_routing "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/maps/RoutePlanningService.kt"
click node_mapsclient "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/maps/BackendMapsClient.kt"
click node_live "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/LiveNavigationScreen.kt"
click node_navengine "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/nav/NavigationEngine.kt"
click node_location "https://github.com/thevirtualkrishnaaa/routewise/blob/main/app/src/main/java/com/example/data/nav/LocationTracker.kt"
click node_map "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/ChargeMapScreen.kt"
click node_zones "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/model/UkRoadChargeScheme.kt"
click node_chargecalc "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/maps/RouteChargeCalculator.kt"
click node_detour "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/maps/CongestionDetour.kt"
click node_vehicles "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/VehicleScreens.kt"
click node_payment "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/PaymentFlowScreens.kt"
click node_history "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/JourneyHistoryScreen.kt"
click node_repository "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/repository/RouteWiseRepository.kt"
click node_localdb "https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/db/RouteWiseDatabase.kt"
click node_nativebridge "https://github.com/thevirtualkrishnaaa/routewise/blob/main/iosApp/RouteWiser/NativeBridge.swift"
click node_functions "https://github.com/thevirtualkrishnaaa/routewise/blob/main/functions/src/index.ts"
click node_validation "https://github.com/thevirtualkrishnaaa/routewise/blob/main/functions/src/validate.ts"

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_app,node_planner,node_search,node_routing,node_mapsclient,node_live,node_navengine,node_location toneBlue
class node_map,node_zones,node_chargecalc,node_detour,node_firestore toneAmber
class node_vehicles,node_payment,node_history,node_repository,node_localdb,node_nativebridge,node_googlemaps toneMint
class node_functions,node_validation toneRose
class node_driver,node_gps toneIndigo
```

## Components

### Planning and navigation

- [RouteWise app](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/RouteWiseApp.kt): `shared/src/commonMain/kotlin/com/example/ui/RouteWiseApp.kt`
- [Route planner](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/RoutePlannerScreen.kt): `shared/src/commonMain/kotlin/com/example/ui/screens/RoutePlannerScreen.kt`
- [Place search](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/service/LocationPredictionService.kt): `shared/src/commonMain/kotlin/com/example/data/service/LocationPredictionService.kt`
- [Route planning](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/maps/RoutePlanningService.kt): `shared/src/commonMain/kotlin/com/example/data/maps/RoutePlanningService.kt`
- [Maps client](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/maps/BackendMapsClient.kt): `shared/src/commonMain/kotlin/com/example/data/maps/BackendMapsClient.kt`
- [Live navigation](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/LiveNavigationScreen.kt): `shared/src/commonMain/kotlin/com/example/ui/screens/LiveNavigationScreen.kt`
- [Navigation engine](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/nav/NavigationEngine.kt): `shared/src/commonMain/kotlin/com/example/data/nav/NavigationEngine.kt`
- [GPS tracking](https://github.com/thevirtualkrishnaaa/routewise/blob/main/app/src/main/java/com/example/data/nav/LocationTracker.kt): `app/src/main/java/com/example/data/nav/LocationTracker.kt`

### Road charges

- [Interactive charge map](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/ChargeMapScreen.kt): `shared/src/commonMain/kotlin/com/example/ui/screens/ChargeMapScreen.kt`
- [UK charge schemes](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/model/UkRoadChargeScheme.kt): `shared/src/commonMain/kotlin/com/example/data/model/UkRoadChargeScheme.kt`
- [Route charge calculator](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/maps/RouteChargeCalculator.kt): `shared/src/commonMain/kotlin/com/example/data/maps/RouteChargeCalculator.kt`
- [Charge avoidance](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/maps/CongestionDetour.kt): `shared/src/commonMain/kotlin/com/example/data/maps/CongestionDetour.kt`

### Persistence and account

- [Vehicle profiles](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/VehicleScreens.kt): `shared/src/commonMain/kotlin/com/example/ui/screens/VehicleScreens.kt`
- [Payment reminders](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/PaymentFlowScreens.kt): `shared/src/commonMain/kotlin/com/example/ui/screens/PaymentFlowScreens.kt`
- [Journey history](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/ui/screens/JourneyHistoryScreen.kt): `shared/src/commonMain/kotlin/com/example/ui/screens/JourneyHistoryScreen.kt`
- [App repository](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/repository/RouteWiseRepository.kt): `shared/src/commonMain/kotlin/com/example/data/repository/RouteWiseRepository.kt`
- [Local database](https://github.com/thevirtualkrishnaaa/routewise/blob/main/shared/src/commonMain/kotlin/com/example/data/db/RouteWiseDatabase.kt): `shared/src/commonMain/kotlin/com/example/data/db/RouteWiseDatabase.kt`
- [iOS Firebase bridge](https://github.com/thevirtualkrishnaaa/routewise/blob/main/iosApp/RouteWiser/NativeBridge.swift): `iosApp/RouteWiser/NativeBridge.swift`

### Cloud services

- [Callable backend](https://github.com/thevirtualkrishnaaa/routewise/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [Request validation](https://github.com/thevirtualkrishnaaa/routewise/blob/main/functions/src/validate.ts): `functions/src/validate.ts`

### Other components

- **Driver**
- **Google Maps APIs**
- **Firebase Firestore**
- **Device GPS**

## Connections

- Driver → RouteWise app: uses (evidence: `README.md`)
- RouteWise app → Route planner: opens planner (evidence: `README.md`)
- Route planner → Place search: searches places (evidence: `README.md`)
- Route planner → Route planning: compares routes (evidence: `README.md`)
- Route planner → Route charge calculator: shows fees (evidence: `README.md`)
- Route planner → Charge avoidance: avoids charges (evidence: `README.md`)
- Route planning → Maps client: requests routing
- Maps client → Callable backend: calls functions
- Callable backend → Request validation: validates requests (evidence: `functions/src/index.ts`)
- Callable backend → Google Maps APIs: requests routes and places (evidence: `functions/src/index.ts`)
- RouteWise app → Interactive charge map: shows charge map (evidence: `README.md`)
- Route charge calculator → UK charge schemes: applies scheme rules
- RouteWise app → Live navigation: starts navigation (evidence: `README.md`)
- Live navigation → Navigation engine: provides guidance (evidence: `README.md`)
- Live navigation → GPS tracking: tracks position (evidence: `README.md`)
- GPS tracking → Device GPS: reads location
- RouteWise app → Vehicle profiles: manages vehicles (evidence: `README.md`)
- Vehicle profiles → Route charge calculator: personalizes fees (evidence: `README.md`)
- RouteWise app → Payment reminders: tracks payments (evidence: `README.md`)
- RouteWise app → Journey history: reviews journeys (evidence: `README.md`)
- App repository → Local database: persists locally
- iOS Firebase bridge → Firebase Firestore: reads and writes (evidence: `iosApp/RouteWiser/NativeBridge.swift`)
- iOS Firebase bridge → Callable backend: calls account deletion (evidence: `iosApp/RouteWiser/NativeBridge.swift`)
- Callable backend → Firebase Firestore: stores feedback and deletes data (evidence: `functions/src/index.ts`)
- RouteWise app → App repository: uses repository
