# sidhazzzzzz/namma_daari architecture

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

- Interactive diagram: https://gitdiagram.com/sidhazzzzzz/namma_daari
- Repository: https://github.com/sidhazzzzzz/namma_daari

## Overview

Namma Daari is a Bengaluru safety-navigation web app. A user enters a destination, the app obtains candidate routes, scores their geometry against crime, accident and facility data, then presents safety-coded routes and map overlays. The sampled code confirms the route fallback logic and safety calculations; README-documented capabilities such as traffic/weather, transit layers and SOS are retained, though their detailed implementation is not fully shown.

Main entry points: [`app.js`](https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js) (Map and trip UI), [`src/services/routeService.js`](https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/routeService.js) (Route retrieval), [`src/services/safetyService.js`](https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/safetyService.js) (Safety scoring), [`functions/api/osrm/[[path]].js`](https://github.com/sidhazzzzzz/namma_daari/blob/main/functions/api/osrm/%5B%5Bpath%5D%5D.js) (OSRM proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Navigation experience"]
  node_webapp["Map and trip UI<br/>[app.js]"]
  node_routechoice["Route presentation<br/>[app.js]"]
  node_transit["Metro and BMTC layers<br/>[app.js]"]
  node_emergency["SOS access<br/>[app.js]"]
  node_trafficweather["Traffic and weather<br/>[app.js]"]
end

subgraph group_routing["Route services"]
  node_geocoding["Place geocoding"]
  node_routeengine["Route retrieval<br/>[routeService.js]"]
  node_osrm["OSRM routing"]
  node_osrmproxy["OSRM proxy<br/>[&#91;&#91;path&#93;&#93;.js]"]
  node_carproxy["OSRM car proxy<br/>[&#91;&#91;path&#93;&#93;.js]"]
  node_tomtomproxy["TomTom routing proxy<br/>[&#91;&#91;path&#93;&#93;.js]"]
  node_tomtom["TomTom routing"]
end

subgraph group_safety["Safety analysis"]
  node_safetycalc["Safety scoring<br/>[safetyService.js]"]
  node_crimedata["Crime hotspots<br/>[safetyService.js]"]
  node_accidents["Accident locations<br/>[accidentData.js]"]
end

subgraph group_citydata["Bengaluru data"]
  node_facilities["Hospitals and police<br/>[facilityData.js]"]
  node_metrodata["Metro network data<br/>[metroData.js]"]
  node_bmtcdata["BMTC network data"]
end

node_traveler(("Traveler"))

node_traveler -->|"enters trip"| node_webapp
node_webapp -.->|"resolves places"| node_geocoding
node_webapp -->|"requests routes"| node_routeengine
node_routeengine -->|"tries primary"| node_osrmproxy
node_osrmproxy -->|"forwards request"| node_osrm
node_routeengine -.->|"tries fallback"| node_carproxy
node_carproxy -->|"forwards request"| node_osrm
node_routeengine -->|"falls back"| node_tomtomproxy
node_tomtomproxy -->|"forwards request"| node_tomtom
node_webapp -->|"scores geometry"| node_safetycalc
node_safetycalc -->|"checks hotspots"| node_crimedata
node_safetycalc -->|"checks accidents"| node_accidents
node_safetycalc -->|"checks protection"| node_facilities
node_routeengine -->|"finds nearby"| node_facilities
node_webapp -->|"shows scored routes"| node_routechoice
node_webapp -->|"renders overlay"| node_metrodata
node_webapp -.->|"renders overlay"| node_bmtcdata
node_webapp -.->|"shows conditions"| node_trafficweather
node_webapp -.->|"offers SOS"| node_emergency

click node_webapp "https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js"
click node_routechoice "https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js"
click node_transit "https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js"
click node_emergency "https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js"
click node_trafficweather "https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js"
click node_geocoding "https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/geocodingService.js"
click node_routeengine "https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/routeService.js"
click node_osrmproxy "https://github.com/sidhazzzzzz/namma_daari/blob/main/functions/api/osrm/%5B%5Bpath%5D%5D.js"
click node_carproxy "https://github.com/sidhazzzzzz/namma_daari/blob/main/functions/api/osrm-car/%5B%5Bpath%5D%5D.js"
click node_tomtomproxy "https://github.com/sidhazzzzzz/namma_daari/blob/main/functions/api/tomtom-routing/%5B%5Bpath%5D%5D.js"
click node_safetycalc "https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/safetyService.js"
click node_crimedata "https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/safetyService.js"
click node_accidents "https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/accidentData.js"
click node_facilities "https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/facilityData.js"
click node_metrodata "https://github.com/sidhazzzzzz/namma_daari/blob/main/data/metroData.js"
click node_bmtcdata "https://github.com/sidhazzzzzz/namma_daari/tree/main/public/data"

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_webapp,node_routechoice,node_transit,node_emergency,node_trafficweather toneBlue
class node_geocoding,node_routeengine,node_osrm,node_osrmproxy,node_carproxy,node_tomtomproxy,node_tomtom toneAmber
class node_safetycalc,node_crimedata,node_accidents toneMint
class node_facilities,node_metrodata,node_bmtcdata toneRose
class node_traveler toneIndigo
```

## Components

### Navigation experience

- [Map and trip UI](https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js): `app.js`
- [Route presentation](https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js): `app.js`
- [Metro and BMTC layers](https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js): `app.js`
- [SOS access](https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js): `app.js`
- [Traffic and weather](https://github.com/sidhazzzzzz/namma_daari/blob/main/app.js): `app.js`

### Route services

- [Place geocoding](https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/geocodingService.js): `src/services/geocodingService.js`
- [Route retrieval](https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/routeService.js): `src/services/routeService.js`
- **OSRM routing**
- [OSRM proxy](https://github.com/sidhazzzzzz/namma_daari/blob/main/functions/api/osrm/%5B%5Bpath%5D%5D.js): `functions/api/osrm/[[path]].js`
- [OSRM car proxy](https://github.com/sidhazzzzzz/namma_daari/blob/main/functions/api/osrm-car/%5B%5Bpath%5D%5D.js): `functions/api/osrm-car/[[path]].js`
- [TomTom routing proxy](https://github.com/sidhazzzzzz/namma_daari/blob/main/functions/api/tomtom-routing/%5B%5Bpath%5D%5D.js): `functions/api/tomtom-routing/[[path]].js`
- **TomTom routing**

### Safety analysis

- [Safety scoring](https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/safetyService.js): `src/services/safetyService.js`
- [Crime hotspots](https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/safetyService.js): `src/services/safetyService.js`
- [Accident locations](https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/accidentData.js): `src/services/accidentData.js`

### Bengaluru data

- [Hospitals and police](https://github.com/sidhazzzzzz/namma_daari/blob/main/src/services/facilityData.js): `src/services/facilityData.js`
- [Metro network data](https://github.com/sidhazzzzzz/namma_daari/blob/main/data/metroData.js): `data/metroData.js`
- [BMTC network data](https://github.com/sidhazzzzzz/namma_daari/tree/main/public/data): `public/data`

### Other components

- **Traveler**

## Connections

- Traveler → Map and trip UI: enters trip (evidence: `README.md`)
- Map and trip UI → Place geocoding: resolves places
- Map and trip UI → Route retrieval: requests routes (evidence: `app.js`)
- Route retrieval → OSRM proxy: tries primary (evidence: `src/services/routeService.js`)
- OSRM proxy → OSRM routing: forwards request (evidence: `functions/api/osrm/[[path]].js`)
- Route retrieval → OSRM car proxy: tries fallback
- OSRM car proxy → OSRM routing: forwards request (evidence: `functions/api/osrm-car/[[path]].js`)
- Route retrieval → TomTom routing proxy: falls back (evidence: `src/services/routeService.js`)
- TomTom routing proxy → TomTom routing: forwards request (evidence: `functions/api/tomtom-routing/[[path]].js`)
- Map and trip UI → Safety scoring: scores geometry (evidence: `app.js`)
- Safety scoring → Crime hotspots: checks hotspots (evidence: `src/services/safetyService.js`)
- Safety scoring → Accident locations: checks accidents (evidence: `src/services/safetyService.js`)
- Safety scoring → Hospitals and police: checks protection (evidence: `src/services/safetyService.js`)
- Route retrieval → Hospitals and police: finds nearby (evidence: `src/services/routeService.js`)
- Map and trip UI → Route presentation: shows scored routes (evidence: `app.js`)
- Map and trip UI → Metro network data: renders overlay (evidence: `app.js`)
- Map and trip UI → BMTC network data: renders overlay
- Map and trip UI → Traffic and weather: shows conditions (evidence: `app.js`)
- Map and trip UI → SOS access: offers SOS (evidence: `app.js`)
