# insanecoder789/navgate architecture

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

- Interactive diagram: https://gitdiagram.com/insanecoder789/navgate
- Repository: https://github.com/insanecoder789/navgate

## Overview

NavGate is a native Android navigation app: users discover a place, choose endpoints and a travel mode, preview routes, then follow one shared trip on a map or optionally in AR. The diagram preserves the documented discovery, routing, guidance, saved-place, manual-route, offline-map, and offline-routing capabilities. Relationships are based on the README and the shown source excerpts; unsampled implementation details are not inferred, and optional providers are marked dashed.

Main entry points: [`navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationBackend.kt`](https://github.com/insanecoder789/navgate/blob/main/navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationBackend.kt) (Navigation backend), [`app/src/main/java/com/rohanc/navgate/ui/journey/JourneyUi.kt`](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/journey/JourneyUi.kt) (Journey screens), [`app/src/main/java/com/rohanc/navgate/ui/state/NavGateViewModel.kt`](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/state/NavGateViewModel.kt) (Journey state and actions), [`app/src/main/java/com/rohanc/navgate/data/search/PhotonPlaceSearch.kt`](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/search/PhotonPlaceSearch.kt) (Place search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_main["Android app entry<br/>[MainActivity.kt]"]
  node_journey["Journey screens<br/>[JourneyUi.kt]"]
  node_viewmodel["Journey state and actions"]
end

subgraph group_discovery["Place discovery"]
  node_search["Place search"]
  node_localplaces[("Offline place indexes<br/>[IndiaPlaceIndex.kt]")]
end

subgraph group_planning["Route planning"]
  node_backend["Navigation backend"]
  node_routecore["Route models and choices<br/>[Routing.kt]"]
  node_valhalla["Valhalla routing"]
  node_offlineprovider["Offline routing provider"]
  node_brouter["BRouter engine<br/>[BRouterEngine.kt]"]
  node_manualroutes["Manual route editing"]
end

subgraph group_guidance["Trip guidance"]
  node_session["Navigation session and progress"]
  node_location["Location and motion tracking<br/>[LocationTracker.kt]"]
  node_map["Map guidance and rendering<br/>[NativeMap.kt]"]
  node_ar["AR guidance and rendering<br/>[ArSessionView.kt]"]
  node_guidance_service["Foreground guidance notification"]
end

subgraph group_state["Local state and data"]
  node_routingdata[("Offline routing data")]
  node_manualstore[("Saved manual routes")]
  node_room[("Trip and route persistence<br/>[NavGateDatabase.kt]")]
  node_preferences[("App preferences")]
  node_mappacks[("Offline map packs<br/>[MapPackStore.kt]")]
end

node_traveler(("Traveler"))
node_android(("Android location and sensors"))
node_photon["Photon search service"]
node_valhalla_service["Valhalla service"]

node_traveler -->|"opens app"| node_main
node_main -->|"shows journey"| node_journey
node_traveler -->|"searches and plans"| node_journey
node_journey -->|"dispatches actions"| node_viewmodel
node_viewmodel -->|"searches places"| node_search
node_search -.->|"queries indexes"| node_localplaces
node_search -.->|"queries online"| node_photon
node_viewmodel -->|"plans trip"| node_backend
node_backend -->|"uses route models"| node_routecore
node_backend -->|"requests routes"| node_valhalla
node_valhalla -->|"requests directions"| node_valhalla_service
node_backend -.->|"uses fallback"| node_offlineprovider
node_offlineprovider -.->|"delegates routing"| node_brouter
node_brouter -.->|"uses installed data"| node_routingdata
node_backend -->|"advances trip"| node_session
node_android -->|"supplies readings"| node_location
node_location -->|"sends fixes"| node_backend
node_backend -->|"persists trip state"| node_room
node_backend -->|"shares trip state"| node_journey
node_journey -->|"renders map view"| node_map
node_journey -.->|"renders optional AR"| node_ar
node_journey -->|"edits itinerary"| node_manualroutes
node_manualroutes -->|"saves routes"| node_manualstore
node_viewmodel -->|"stores preferences"| node_preferences
node_journey -.->|"manages map packs"| node_mappacks
node_backend -.->|"updates notification"| node_guidance_service

click node_main "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/MainActivity.kt"
click node_journey "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/journey/JourneyUi.kt"
click node_viewmodel "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/state/NavGateViewModel.kt"
click node_search "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/search/PhotonPlaceSearch.kt"
click node_localplaces "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/search/IndiaPlaceIndex.kt"
click node_backend "https://github.com/insanecoder789/navgate/blob/main/navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationBackend.kt"
click node_routecore "https://github.com/insanecoder789/navgate/blob/main/navigation-core/src/main/kotlin/com/rohanc/navgate/core/Routing.kt"
click node_valhalla "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/routing/ValhallaRoutingProvider.kt"
click node_offlineprovider "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/routing/offline/OfflineRoutingProvider.kt"
click node_brouter "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/routing/offline/BRouterEngine.kt"
click node_routingdata "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/routing/offline/RoutingDataStore.kt"
click node_session "https://github.com/insanecoder789/navgate/blob/main/navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationSession.kt"
click node_location "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/location/LocationTracker.kt"
click node_map "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/NativeMap.kt"
click node_ar "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/ar/ArSessionView.kt"
click node_manualroutes "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/ManualRoutePanel.kt"
click node_manualstore "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/local/ManualRouteStore.kt"
click node_room "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/local/NavGateDatabase.kt"
click node_preferences "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/local/DataStoreAppPreferencesStore.kt"
click node_mappacks "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/maps/MapPackStore.kt"
click node_guidance_service "https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/nav/NavigationService.kt"

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_main,node_journey,node_viewmodel toneBlue
class node_search,node_localplaces toneAmber
class node_backend,node_routecore,node_valhalla,node_offlineprovider,node_brouter,node_manualroutes toneMint
class node_session,node_location,node_map,node_ar,node_guidance_service toneRose
class node_routingdata,node_manualstore,node_room,node_preferences,node_mappacks,node_traveler,node_android,node_photon,node_valhalla_service toneIndigo
```

## Components

### App experience

- [Android app entry](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/MainActivity.kt): `app/src/main/java/com/rohanc/navgate/MainActivity.kt`
- [Journey screens](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/journey/JourneyUi.kt): `app/src/main/java/com/rohanc/navgate/ui/journey/JourneyUi.kt`
- [Journey state and actions](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/state/NavGateViewModel.kt): `app/src/main/java/com/rohanc/navgate/ui/state/NavGateViewModel.kt`

### Place discovery

- [Place search](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/search/PhotonPlaceSearch.kt): `app/src/main/java/com/rohanc/navgate/data/search/PhotonPlaceSearch.kt`
- [Offline place indexes](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/search/IndiaPlaceIndex.kt): `app/src/main/java/com/rohanc/navgate/data/search/IndiaPlaceIndex.kt`

### Route planning

- [Navigation backend](https://github.com/insanecoder789/navgate/blob/main/navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationBackend.kt): `navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationBackend.kt`
- [Route models and choices](https://github.com/insanecoder789/navgate/blob/main/navigation-core/src/main/kotlin/com/rohanc/navgate/core/Routing.kt): `navigation-core/src/main/kotlin/com/rohanc/navgate/core/Routing.kt`
- [Valhalla routing](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/routing/ValhallaRoutingProvider.kt): `app/src/main/java/com/rohanc/navgate/data/routing/ValhallaRoutingProvider.kt`
- [Offline routing provider](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/routing/offline/OfflineRoutingProvider.kt): `app/src/main/java/com/rohanc/navgate/data/routing/offline/OfflineRoutingProvider.kt`
- [BRouter engine](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/routing/offline/BRouterEngine.kt): `app/src/main/java/com/rohanc/navgate/data/routing/offline/BRouterEngine.kt`
- [Manual route editing](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/ManualRoutePanel.kt): `app/src/main/java/com/rohanc/navgate/ui/ManualRoutePanel.kt`

### Trip guidance

- [Navigation session and progress](https://github.com/insanecoder789/navgate/blob/main/navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationSession.kt): `navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationSession.kt`
- [Location and motion tracking](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/location/LocationTracker.kt): `app/src/main/java/com/rohanc/navgate/ui/location/LocationTracker.kt`
- [Map guidance and rendering](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/NativeMap.kt): `app/src/main/java/com/rohanc/navgate/ui/NativeMap.kt`
- [AR guidance and rendering](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/ui/ar/ArSessionView.kt): `app/src/main/java/com/rohanc/navgate/ui/ar/ArSessionView.kt`
- [Foreground guidance notification](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/nav/NavigationService.kt): `app/src/main/java/com/rohanc/navgate/nav/NavigationService.kt`

### Local state and data

- [Offline routing data](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/routing/offline/RoutingDataStore.kt): `app/src/main/java/com/rohanc/navgate/data/routing/offline/RoutingDataStore.kt`
- [Saved manual routes](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/local/ManualRouteStore.kt): `app/src/main/java/com/rohanc/navgate/data/local/ManualRouteStore.kt`
- [Trip and route persistence](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/local/NavGateDatabase.kt): `app/src/main/java/com/rohanc/navgate/data/local/NavGateDatabase.kt`
- [App preferences](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/local/DataStoreAppPreferencesStore.kt): `app/src/main/java/com/rohanc/navgate/data/local/DataStoreAppPreferencesStore.kt`
- [Offline map packs](https://github.com/insanecoder789/navgate/blob/main/app/src/main/java/com/rohanc/navgate/data/maps/MapPackStore.kt): `app/src/main/java/com/rohanc/navgate/data/maps/MapPackStore.kt`

### Other components

- **Traveler**
- **Android location and sensors**
- **Photon search service**
- **Valhalla service**

## Connections

- Traveler → Android app entry: opens app
- Android app entry → Journey screens: shows journey (evidence: `app/src/main/java/com/rohanc/navgate/MainActivity.kt`)
- Traveler → Journey screens: searches and plans
- Journey screens → Journey state and actions: dispatches actions
- Journey state and actions → Place search: searches places
- Place search → Offline place indexes: queries indexes
- Place search → Photon search service: queries online
- Journey state and actions → Navigation backend: plans trip
- Navigation backend → Route models and choices: uses route models (evidence: `navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationBackend.kt`)
- Navigation backend → Valhalla routing: requests routes
- Valhalla routing → Valhalla service: requests directions
- Navigation backend → Offline routing provider: uses fallback
- Offline routing provider → BRouter engine: delegates routing (evidence: `app/src/main/java/com/rohanc/navgate/data/routing/offline/BRouterEngine.kt`)
- BRouter engine → Offline routing data: uses installed data
- Navigation backend → Navigation session and progress: advances trip (evidence: `navigation-core/src/main/kotlin/com/rohanc/navgate/core/NavigationBackend.kt`)
- Android location and sensors → Location and motion tracking: supplies readings
- Location and motion tracking → Navigation backend: sends fixes
- Navigation backend → Trip and route persistence: persists trip state
- Navigation backend → Journey screens: shares trip state
- Journey screens → Map guidance and rendering: renders map view
- Journey screens → AR guidance and rendering: renders optional AR
- Journey screens → Manual route editing: edits itinerary
- Manual route editing → Saved manual routes: saves routes
- Journey state and actions → App preferences: stores preferences
- Journey screens → Offline map packs: manages map packs
- Navigation backend → Foreground guidance notification: updates notification
