# saurabhhdubey/police-ambulance architecture

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

- Interactive diagram: https://gitdiagram.com/saurabhhdubey/police-ambulance
- Repository: https://github.com/saurabhhdubey/police-ambulance

## Overview

This repository is an emergency-services web app with police-station lookup and ambulance-related pages, plus a registration API. The user journey begins at a portal, then navigates to police or ambulance features; the client registration form can submit to the server, which persists a user record in MongoDB. Police lookup geocodes a location, queries nearby stations, and displays results on a map. The tree contains parallel `src/` and `client/src/` frontends; both are represented. The README is only a Vite template, so product capabilities are inferred from sampled source. Some duplicate modules were not excerpted, so their internal behavior is not assumed.

Main entry points: [`src/main.jsx`](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/main.jsx) (Root Router), [`client/src/main.jsx`](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/main.jsx) (Client Router), [`src/components/Police/police.jsx`](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Police/police.jsx) (Root Police Lookup), [`client/src/components/Police/police.jsx`](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Police/police.jsx) (Client Police Lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_root_ui["Root Frontend"]
  node_root_router["Root Router<br/>[main.jsx]"]
  node_root_portal["Root Portal<br/>[Portal.jsx]"]
  node_root_police["Root Police Lookup<br/>[police.jsx]"]
  node_root_police_about["Root Police About<br/>[About.jsx]"]
  node_root_police_contact["Root Police Contact<br/>[Contact.jsx]"]
  node_root_ambulance["Root Ambulance<br/>[Ambulance.jsx]"]
  node_root_ambulance_info["Root Information<br/>[Information.jsx]"]
  node_root_ambulance_register["Root Registration Form<br/>[Register.jsx]"]
end

subgraph group_client_ui["Client Frontend"]
  node_client_router["Client Router<br/>[main.jsx]"]
  node_client_portal["Client Portal<br/>[Portal.jsx]"]
  node_client_police["Client Police Lookup<br/>[police.jsx]"]
  node_client_police_about["Client Police About<br/>[About.jsx]"]
  node_client_police_contact["Client Police Contact<br/>[Contact.jsx]"]
  node_client_ambulance["Client Ambulance<br/>[Ambulance.jsx]"]
  node_client_ambulance_info["Client Information<br/>[Information.jsx]"]
  node_client_ambulance_register["Client Registration Form<br/>[Register.jsx]"]
end

subgraph group_backend["Registration Backend"]
  node_api["Registration API<br/>[index.js]"]
  node_user_model["User Model<br/>[User.js]"]
end

node_user(("Visitor"))
node_mongo[("MongoDB")]
node_geocoder["Nominatim"]
node_station_data["Overpass API"]

node_user -->|"opens app"| node_root_router
node_root_router -->|"routes root"| node_root_portal
node_root_router -->|"routes police"| node_root_police
node_root_router -->|"routes about"| node_root_police_about
node_root_router -->|"routes contact"| node_root_police_contact
node_root_router -->|"routes ambulance"| node_root_ambulance
node_root_router -->|"routes information"| node_root_ambulance_info
node_root_router -->|"routes registration"| node_root_ambulance_register
node_root_portal -->|"navigates to"| node_root_police
node_root_portal -->|"navigates to"| node_root_ambulance
node_root_police -->|"geocodes location"| node_geocoder
node_root_police -->|"queries stations"| node_station_data
node_user -->|"opens app"| node_client_router
node_client_router -->|"routes root"| node_client_portal
node_client_router -->|"routes police"| node_client_police
node_client_router -->|"routes about"| node_client_police_about
node_client_router -->|"routes contact"| node_client_police_contact
node_client_router -->|"routes ambulance"| node_client_ambulance
node_client_router -->|"routes information"| node_client_ambulance_info
node_client_router -->|"routes registration"| node_client_ambulance_register
node_client_portal -.->|"navigates to"| node_client_police
node_client_portal -.->|"navigates to"| node_client_ambulance
node_client_police -->|"geocodes location"| node_geocoder
node_client_police -->|"queries stations"| node_station_data
node_client_ambulance_register -->|"posts registration"| node_api
node_api -->|"creates record"| node_user_model
node_api -->|"connects and saves"| node_mongo

click node_root_router "https://github.com/saurabhhdubey/police-ambulance/blob/main/src/main.jsx"
click node_root_portal "https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Portal/Portal.jsx"
click node_root_police "https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Police/police.jsx"
click node_root_police_about "https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Police/About.jsx"
click node_root_police_contact "https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Police/Contact.jsx"
click node_root_ambulance "https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Ambulance/Ambulance.jsx"
click node_root_ambulance_info "https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Ambulance/Information.jsx"
click node_root_ambulance_register "https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Ambulance/Register.jsx"
click node_client_router "https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/main.jsx"
click node_client_portal "https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Portal/Portal.jsx"
click node_client_police "https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Police/police.jsx"
click node_client_police_about "https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Police/About.jsx"
click node_client_police_contact "https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Police/Contact.jsx"
click node_client_ambulance "https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Ambulance/Ambulance.jsx"
click node_client_ambulance_info "https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Ambulance/Information.jsx"
click node_client_ambulance_register "https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Ambulance/Register.jsx"
click node_api "https://github.com/saurabhhdubey/police-ambulance/blob/main/server/index.js"
click node_user_model "https://github.com/saurabhhdubey/police-ambulance/blob/main/server/models/User.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_root_router,node_root_portal,node_root_police,node_root_police_about,node_root_police_contact,node_root_ambulance,node_root_ambulance_info,node_root_ambulance_register toneBlue
class node_client_router,node_client_portal,node_client_police,node_client_police_about,node_client_police_contact,node_client_ambulance,node_client_ambulance_info,node_client_ambulance_register,node_mongo toneAmber
class node_api,node_user_model,node_station_data toneMint
class node_user,node_geocoder toneIndigo
```

## Components

### Root Frontend

- [Root Router](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/main.jsx): `src/main.jsx`
- [Root Portal](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Portal/Portal.jsx): `src/components/Portal/Portal.jsx`
- [Root Police Lookup](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Police/police.jsx): `src/components/Police/police.jsx`
- [Root Police About](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Police/About.jsx): `src/components/Police/About.jsx`
- [Root Police Contact](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Police/Contact.jsx): `src/components/Police/Contact.jsx`
- [Root Ambulance](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Ambulance/Ambulance.jsx): `src/components/Ambulance/Ambulance.jsx`
- [Root Information](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Ambulance/Information.jsx): `src/components/Ambulance/Information.jsx`
- [Root Registration Form](https://github.com/saurabhhdubey/police-ambulance/blob/main/src/components/Ambulance/Register.jsx): `src/components/Ambulance/Register.jsx`

### Client Frontend

- [Client Router](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/main.jsx): `client/src/main.jsx`
- [Client Portal](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Portal/Portal.jsx): `client/src/components/Portal/Portal.jsx`
- [Client Police Lookup](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Police/police.jsx): `client/src/components/Police/police.jsx`
- [Client Police About](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Police/About.jsx): `client/src/components/Police/About.jsx`
- [Client Police Contact](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Police/Contact.jsx): `client/src/components/Police/Contact.jsx`
- [Client Ambulance](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Ambulance/Ambulance.jsx): `client/src/components/Ambulance/Ambulance.jsx`
- [Client Information](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Ambulance/Information.jsx): `client/src/components/Ambulance/Information.jsx`
- [Client Registration Form](https://github.com/saurabhhdubey/police-ambulance/blob/main/client/src/components/Ambulance/Register.jsx): `client/src/components/Ambulance/Register.jsx`

### Registration Backend

- [Registration API](https://github.com/saurabhhdubey/police-ambulance/blob/main/server/index.js): `server/index.js`
- [User Model](https://github.com/saurabhhdubey/police-ambulance/blob/main/server/models/User.js): `server/models/User.js`

### Other components

- **Visitor**
- **MongoDB**
- **Nominatim**
- **Overpass API**

## Connections

- Visitor → Root Router: opens app (evidence: `src/main.jsx`)
- Root Router → Root Portal: routes root (evidence: `src/main.jsx`)
- Root Router → Root Police Lookup: routes police (evidence: `src/main.jsx`)
- Root Router → Root Police About: routes about (evidence: `src/main.jsx`)
- Root Router → Root Police Contact: routes contact (evidence: `src/main.jsx`)
- Root Router → Root Ambulance: routes ambulance (evidence: `src/main.jsx`)
- Root Router → Root Information: routes information (evidence: `src/main.jsx`)
- Root Router → Root Registration Form: routes registration (evidence: `src/main.jsx`)
- Root Portal → Root Police Lookup: navigates to (evidence: `src/components/Portal/Portal.jsx`)
- Root Portal → Root Ambulance: navigates to (evidence: `src/components/Portal/Portal.jsx`)
- Root Police Lookup → Nominatim: geocodes location (evidence: `src/components/Police/police.jsx`)
- Root Police Lookup → Overpass API: queries stations (evidence: `src/components/Police/police.jsx`)
- Visitor → Client Router: opens app (evidence: `client/src/main.jsx`)
- Client Router → Client Portal: routes root (evidence: `client/src/main.jsx`)
- Client Router → Client Police Lookup: routes police (evidence: `client/src/main.jsx`)
- Client Router → Client Police About: routes about (evidence: `client/src/main.jsx`)
- Client Router → Client Police Contact: routes contact (evidence: `client/src/main.jsx`)
- Client Router → Client Ambulance: routes ambulance (evidence: `client/src/main.jsx`)
- Client Router → Client Information: routes information (evidence: `client/src/main.jsx`)
- Client Router → Client Registration Form: routes registration (evidence: `client/src/main.jsx`)
- Client Portal → Client Police Lookup: navigates to
- Client Portal → Client Ambulance: navigates to
- Client Police Lookup → Nominatim: geocodes location (evidence: `client/src/components/Police/police.jsx`)
- Client Police Lookup → Overpass API: queries stations (evidence: `client/src/components/Police/police.jsx`)
- Client Registration Form → Registration API: posts registration (evidence: `client/src/components/Ambulance/Register.jsx`)
- Registration API → User Model: creates record (evidence: `server/index.js`)
- Registration API → MongoDB: connects and saves (evidence: `server/index.js`)
