# devmj007/ner-logistics architecture

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

- Interactive diagram: https://gitdiagram.com/devmj007/ner-logistics
- Repository: https://github.com/devmj007/ner-logistics

## Overview

NER Logistics Intelligence is a browser-based logistics and accessibility prototype for monitoring regional disruptions and choosing safer corridors. Users view operational dashboards, inspect weather, flood and satellite intelligence, calculate ranked routes, submit field reports, and enable alerts. The browser communicates with FastAPI; backend handlers coordinate risk assessment, integrations and persistence. README-described frontend and Firebase capabilities are retained, but some wiring is not shown in the sampled excerpts, so those relationships are documented rather than inferred from module names.

Main entry points: [`backend/app/main.py`](https://github.com/devmj007/ner-logistics/blob/main/backend/app/main.py) (API handlers), [`backend/app/config.py`](https://github.com/devmj007/ner-logistics/blob/main/backend/app/config.py) (Integration settings), [`app.js`](https://github.com/devmj007/ner-logistics/blob/main/app.js) (Operations UI), [`backend/app/services/osrm_service.py`](https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/osrm_service.py) (Route ranking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_webapp["Operations UI<br/>[app.js]"]
  node_web_auth["Browser Firebase<br/>[firebase-client.js]"]
  node_push_worker["Push worker"]
end

subgraph group_api["API and coordination"]
  node_fastapi["API handlers<br/>[main.py]"]
  node_settings["Integration settings<br/>[config.py]"]
end

subgraph group_intelligence["Risk intelligence"]
  node_weather["Weather feed<br/>[weather_service.py]"]
  node_flood["Flood feed<br/>[flood_service.py]"]
  node_satellite["Satellite search"]
  node_risk["Risk scoring<br/>[risk_service.py]"]
  node_routing["Route ranking<br/>[osrm_service.py]"]
end

subgraph group_state["Persistence and alerts"]
  node_db_access["Data access<br/>[database.py]"]
  node_sqlite[("Local data store<br/>[ner_data.db]")]
  node_firebase_admin["Admin messaging"]
  node_postgis["PostGIS starter schema<br/>[schema.sql]"]
end

node_operator(("Logistics user"))
node_open_meteo["Open-Meteo"]
node_flood_api["Open-Meteo Flood"]
node_osrm["OSRM"]
node_sentinel["Sentinel Hub"]
node_firebase["Firebase services"]

node_operator -->|"uses"| node_webapp
node_webapp -->|"requests data"| node_fastapi
node_fastapi -->|"calls"| node_weather
node_fastapi -->|"calls"| node_flood
node_fastapi -->|"calls"| node_satellite
node_fastapi -->|"calls"| node_routing
node_fastapi -->|"calls"| node_risk
node_fastapi -->|"reads and writes"| node_db_access
node_weather -->|"fetches forecast"| node_open_meteo
node_flood -->|"fetches discharge"| node_flood_api
node_routing -->|"fetches routes"| node_osrm
node_routing -->|"classifies risk"| node_risk
node_satellite -->|"searches observations"| node_sentinel
node_weather -->|"loads endpoints"| node_settings
node_flood -->|"loads endpoints"| node_settings
node_routing -->|"loads endpoint"| node_settings
node_satellite -->|"loads credentials"| node_settings
node_firebase_admin -->|"loads credentials"| node_settings
node_db_access -->|"persists records"| node_sqlite
node_fastapi -->|"verifies and sends"| node_firebase_admin
node_webapp -->|"uses login"| node_web_auth
node_webapp -->|"registers alerts"| node_push_worker
node_firebase_admin -->|"sends push"| node_firebase
node_web_auth -->|"authenticates"| node_firebase
node_postgis -.->|"schema relationship"| node_db_access

click node_webapp "https://github.com/devmj007/ner-logistics/blob/main/app.js"
click node_web_auth "https://github.com/devmj007/ner-logistics/blob/main/firebase-client.js"
click node_push_worker "https://github.com/devmj007/ner-logistics/blob/main/firebase-messaging-sw.js"
click node_fastapi "https://github.com/devmj007/ner-logistics/blob/main/backend/app/main.py"
click node_settings "https://github.com/devmj007/ner-logistics/blob/main/backend/app/config.py"
click node_weather "https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/weather_service.py"
click node_flood "https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/flood_service.py"
click node_satellite "https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/copernicus_service.py"
click node_risk "https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/risk_service.py"
click node_routing "https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/osrm_service.py"
click node_db_access "https://github.com/devmj007/ner-logistics/blob/main/backend/app/database.py"
click node_sqlite "https://github.com/devmj007/ner-logistics/blob/main/ner_data.db"
click node_firebase_admin "https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/firebase_service.py"
click node_postgis "https://github.com/devmj007/ner-logistics/blob/main/database/schema.sql"

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_web_auth,node_push_worker,node_operator toneBlue
class node_fastapi,node_settings toneAmber
class node_weather,node_flood,node_satellite,node_risk,node_routing toneMint
class node_db_access,node_sqlite,node_firebase_admin,node_postgis toneRose
class node_open_meteo,node_flood_api,node_osrm,node_sentinel,node_firebase toneIndigo
```

## Components

### Browser experience

- [Operations UI](https://github.com/devmj007/ner-logistics/blob/main/app.js): `app.js`
- [Browser Firebase](https://github.com/devmj007/ner-logistics/blob/main/firebase-client.js): `firebase-client.js`
- [Push worker](https://github.com/devmj007/ner-logistics/blob/main/firebase-messaging-sw.js): `firebase-messaging-sw.js`

### API and coordination

- [API handlers](https://github.com/devmj007/ner-logistics/blob/main/backend/app/main.py): `backend/app/main.py`
- [Integration settings](https://github.com/devmj007/ner-logistics/blob/main/backend/app/config.py): `backend/app/config.py`

### Risk intelligence

- [Weather feed](https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/weather_service.py): `backend/app/services/weather_service.py`
- [Flood feed](https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/flood_service.py): `backend/app/services/flood_service.py`
- [Satellite search](https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/copernicus_service.py): `backend/app/services/copernicus_service.py`
- [Risk scoring](https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/risk_service.py): `backend/app/services/risk_service.py`
- [Route ranking](https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/osrm_service.py): `backend/app/services/osrm_service.py`

### Persistence and alerts

- [Data access](https://github.com/devmj007/ner-logistics/blob/main/backend/app/database.py): `backend/app/database.py`
- [Local data store](https://github.com/devmj007/ner-logistics/blob/main/ner_data.db): `ner_data.db`
- [Admin messaging](https://github.com/devmj007/ner-logistics/blob/main/backend/app/services/firebase_service.py): `backend/app/services/firebase_service.py`
- [PostGIS starter schema](https://github.com/devmj007/ner-logistics/blob/main/database/schema.sql): `database/schema.sql`

### Other components

- **Logistics user**
- **Open-Meteo**
- **Open-Meteo Flood**
- **OSRM**
- **Sentinel Hub**
- **Firebase services**

## Connections

- Logistics user → Operations UI: uses (evidence: `README.md`)
- Operations UI → API handlers: requests data (evidence: `README.md`)
- API handlers → Weather feed: calls (evidence: `backend/app/main.py`)
- API handlers → Flood feed: calls (evidence: `backend/app/main.py`)
- API handlers → Satellite search: calls (evidence: `backend/app/main.py`)
- API handlers → Route ranking: calls (evidence: `backend/app/main.py`)
- API handlers → Risk scoring: calls (evidence: `backend/app/main.py`)
- API handlers → Data access: reads and writes (evidence: `backend/app/main.py`)
- Weather feed → Open-Meteo: fetches forecast (evidence: `backend/app/services/weather_service.py`)
- Flood feed → Open-Meteo Flood: fetches discharge (evidence: `backend/app/services/flood_service.py`)
- Route ranking → OSRM: fetches routes (evidence: `backend/app/services/osrm_service.py`)
- Route ranking → Risk scoring: classifies risk (evidence: `backend/app/services/osrm_service.py`)
- Satellite search → Sentinel Hub: searches observations (evidence: `backend/app/services/copernicus_service.py`)
- Weather feed → Integration settings: loads endpoints (evidence: `backend/app/services/weather_service.py`)
- Flood feed → Integration settings: loads endpoints (evidence: `backend/app/services/flood_service.py`)
- Route ranking → Integration settings: loads endpoint (evidence: `backend/app/services/osrm_service.py`)
- Satellite search → Integration settings: loads credentials (evidence: `backend/app/services/copernicus_service.py`)
- Admin messaging → Integration settings: loads credentials (evidence: `backend/app/services/firebase_service.py`)
- Data access → Local data store: persists records (evidence: `backend/app/database.py`)
- API handlers → Admin messaging: verifies and sends (evidence: `backend/app/main.py`)
- Operations UI → Browser Firebase: uses login (evidence: `README.md`)
- Operations UI → Push worker: registers alerts (evidence: `README.md`)
- Admin messaging → Firebase services: sends push (evidence: `backend/app/services/firebase_service.py`)
- Browser Firebase → Firebase services: authenticates (evidence: `README.md`)
- PostGIS starter schema → Data access: schema relationship
