# vaishnavi-katroj/saferoute architecture

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

- Interactive diagram: https://gitdiagram.com/vaishnavi-katroj/saferoute
- Repository: https://github.com/vaishnavi-katroj/saferoute

## Overview

SafeRoute is a safety-aware route planner. Users enter a start and destination, receive location suggestions, request a route, then view route guidance and safety information on an interactive map. The backend proxies place search and driving directions to external services. The map page was not sampled, so its detailed internal behavior is represented only at the capability level documented in the README; those links cite the README.

Main entry points: [`frontend/src/pages/MapPage.jsx`](https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/MapPage.jsx) (Route map), [`frontend/src/pages/Home.jsx`](https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/Home.jsx) (Route input), [`backend/server.js`](https://github.com/vaishnavi-katroj/saferoute/blob/main/backend/server.js) (API server), [`frontend/src/App.jsx`](https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/App.jsx) (Page router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_home["Route input<br/>[Home.jsx]"]
  node_app["Page router<br/>[App.jsx]"]
  node_map["Route map<br/>[MapPage.jsx]"]
  node_safety["Safety analysis<br/>[MapPage.jsx]"]
  node_guidance["Turn guidance<br/>[MapPage.jsx]"]
end

subgraph group_backend["Route services"]
  node_server["API server<br/>[server.js]"]
  node_search["Place search<br/>[server.js]"]
  node_directions["Route directions<br/>[server.js]"]
end

subgraph group_external["Mapping providers"]
  node_nominatim["Nominatim"]
  node_ors["OpenRouteService"]
  node_osm["OpenStreetMap"]
end

node_user(("Traveler"))

node_user -->|"enters locations"| node_home
node_home -->|"requests suggestions"| node_search
node_search -->|"searches places"| node_nominatim
node_home -->|"navigates to map"| node_app
node_app -->|"routes /map"| node_map
node_map -->|"requests directions"| node_server
node_server -->|"handles route request"| node_directions
node_directions -->|"requests directions"| node_ors
node_server -->|"returns route data"| node_map
node_map -->|"assesses route risk"| node_safety
node_map -->|"shows instructions"| node_guidance
node_map -.->|"visualizes map"| node_osm

click node_home "https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/Home.jsx"
click node_app "https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/App.jsx"
click node_map "https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/MapPage.jsx"
click node_safety "https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/MapPage.jsx"
click node_guidance "https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/MapPage.jsx"
click node_server "https://github.com/vaishnavi-katroj/saferoute/blob/main/backend/server.js"
click node_search "https://github.com/vaishnavi-katroj/saferoute/blob/main/backend/server.js"
click node_directions "https://github.com/vaishnavi-katroj/saferoute/blob/main/backend/server.js"

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_home,node_app,node_map,node_safety,node_guidance toneBlue
class node_server,node_search,node_directions toneAmber
class node_nominatim,node_ors,node_osm toneMint
class node_user toneIndigo
```

## Components

### Frontend experience

- [Route input](https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Page router](https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Route map](https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/MapPage.jsx): `frontend/src/pages/MapPage.jsx`
- [Safety analysis](https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/MapPage.jsx): `frontend/src/pages/MapPage.jsx`
- [Turn guidance](https://github.com/vaishnavi-katroj/saferoute/blob/main/frontend/src/pages/MapPage.jsx): `frontend/src/pages/MapPage.jsx`

### Route services

- [API server](https://github.com/vaishnavi-katroj/saferoute/blob/main/backend/server.js): `backend/server.js`
- [Place search](https://github.com/vaishnavi-katroj/saferoute/blob/main/backend/server.js): `backend/server.js`
- [Route directions](https://github.com/vaishnavi-katroj/saferoute/blob/main/backend/server.js): `backend/server.js`

### Mapping providers

- **Nominatim**
- **OpenRouteService**
- **OpenStreetMap**

### Other components

- **Traveler**

## Connections

- Traveler → Route input: enters locations (evidence: `README.md`)
- Route input → Place search: requests suggestions (evidence: `frontend/src/pages/Home.jsx`)
- Place search → Nominatim: searches places (evidence: `backend/server.js`)
- Route input → Page router: navigates to map (evidence: `frontend/src/pages/Home.jsx`)
- Page router → Route map: routes /map (evidence: `frontend/src/App.jsx`)
- Route map → API server: requests directions (evidence: `README.md`)
- API server → Route directions: handles route request (evidence: `backend/server.js`)
- Route directions → OpenRouteService: requests directions (evidence: `backend/server.js`)
- API server → Route map: returns route data (evidence: `README.md`)
- Route map → Safety analysis: assesses route risk (evidence: `README.md`)
- Route map → Turn guidance: shows instructions (evidence: `README.md`)
- Route map → OpenStreetMap: visualizes map (evidence: `README.md`)
