Path OS is a full-stack, climate-resilient urban navigation dashboard. The platform orchestrates real-time environmental APIs with static datasets to calculate commuter routing, prioritizing ecological safety and shielding commuters from extreme weather, smog boundaries, high-decibel zones, and urban floodings.
Path OS acts as a client-side Crisis Command HUD and an orchestration backend that bridges public geodata interfaces with localized environmental matrices:
graph TD
subgraph frontend ["Frontend (React 18 / Vite / Leaflet)"]
A[App Component] --> B[MapCanvas Map Overlay]
A --> C[ControlPanel Sidebar]
C --> D[DualRoutingSelector]
A --> E[AlertTicker Marquee]
A --> F[AirGuard Offline Dashboard]
end
subgraph backend ["Backend (Express Orchestrator)"]
G[server.js] --> H["/api/spatial"]
G --> I["/api/route"]
G --> J["/api/weather"]
G --> K["/api/aqi"]
G --> L["/api/overpass"]
end
subgraph services ["Upstream API Layer & Local Datasets"]
M[(Mock PostGIS Spatial Layer)] --> H
N[OSRM Free Routing API] --> I
O[OpenRouteService API] --> |Avoid Polygons| I
P[Open-Meteo API] --> J
Q[OpenAQ API v3] --> K
R[OSM Overpass API] --> L
end
A -->|API Calls via Axios Proxy| G
- π Key Core Features
- π οΈ Technology Stack
- π Project Structure
- π Getting Started
- π API Endpoint Reference Matrix
- π§ Deep Dive: Environmental Sub-systems
- π Environment Variables & Security Configuration
- π License
A secure workspace access manager enforcing credential authentication. Commuter operators must authenticate before gaining access to the Crisis Command dashboard.
Routes can be plotted between two addresses using either:
- Pulse (Fastest Route): Utilizing OSRM API for rapid, traffic-centric driving routes.
- Haven (Safe Route): Dynamic route mapping through OpenRouteService (ORS). Instructs ORS to avoid spatial danger hazards (e.g., knee-/chest-deep flooding, high-decibel corridors) by converting threat polygons into avoided routing geometry boundaries.
- π¨ AirGuard (Smog Coverage): Real-time AQI tracking (via US EPA breakpoints) using US-EPA PM2.5 sensors with animated, translucent smog layers.
- π§οΈ Monsoon Matrix (Flood Risk): Dynamic rain gauge metrics integrated with flood zone safety vectors.
- βοΈ ShadeSeeker (Solar Shadows): Interactive solar azimuth calculator fetching building footprints and heights from the OSM Overpass API to display shadows depending on the selected hour of the day.
- π NavQuiet (Acoustic Corridors): Decibel contour maps identifying serene zones and heavy noise corridors to maximize comfort.
- AlertTicker: A scrolling marquee detailing emergency ecological constraints (e.g. hazardous PM2.5 levels, storm warnings, or routing status).
- Live Clock: A localized clock panel (
en-INtimezone formatting) for operational timekeeping. - AirGuard Offline Fail-Safe: A full-viewport compass interface that triggers when Internet connectivity is lost, displaying direction and cached coordinates for the nearest emergency shelters.
- Frontend: React 18, Vite, Leaflet & React Leaflet (Map visualization), LocalForage (Offline caching), Tailwind CSS
- Backend: Node.js, Express, Axios (Upstream client requests), Dotenv
- External APIs:
- OSRM (Open Source Routing Machine) β Free route solver
- OpenRouteService (ORS) β Free multi-criteria routing
- Open-Meteo β Hourly and historical weather forecasts
- OpenAQ β Public air quality dataset monitoring
- OpenStreetMap (Nominatim & Overpass query engine) β Location search & geodata
Path OS/
βββ backend/
β βββ data/ # Spatial GeoJSON datasets (flood, noise, serene, smog, shelters)
β βββ routes/
β β βββ aqi.js # OpenAQ wrapper + US EPA AQI calculator
β β βββ overpass.js # Overpass API building coordinates & heights parser
β β βββ routing.js # Dual-mode router (pulse vs haven)
β β βββ weather.js # Weather metrics using Open-Meteo
β βββ server.js # Express app setup and middleware definition
β βββ package.json
βββ frontend/
βββ src/
β βββ components/ # UI dashboard layers (AirGuard, ShadeSeeker, NavQuiet, Login, etc.)
β βββ hooks/ # Custom hooks (e.g., useOnlineStatus for offline trigger)
β βββ services/ # Axios api request controllers
β βββ App.jsx # Main state management and orchestration
β βββ index.css # Custom maps, panels, and ticker animations
β βββ main.jsx
βββ tailwind.config.js
βββ vite.config.js
βββ package.json
Follow these steps to setup Path OS in your local workspace.
- Node.js:
v16.xor newer - npm:
v8.xor newer
- Clone down the application to your local project folder.
- Install development packages for the backend:
cd backend npm install - Install dependencies for the frontend:
cd ../frontend npm install
To run Path OS, spin up the backend and frontend dev environments concurrently in two separate terminal windows:
- Terminal 1 (Backend):
The backend server will launch on
cd backend npm run devhttp://localhost:3001(configuration variables log automatically on start). - Terminal 2 (Frontend):
The Vite dev server will boot up and establish the frontend on
cd frontend npm run devhttp://localhost:5173. Open your browser to view the login interface!
The backend orchestrates intermediate API connections to avoid CORS issues and coordinates regional proxies:
| Endpoint | Method | Key Parameters | Return Data Details | Fail-Safe & Fallback Behavior |
|---|---|---|---|---|
/api/health |
GET |
None | Returns JSON describing server status, timestamp, and version. | Standard Express 500 boundary returns error message. |
/api/spatial |
GET |
None | Returns complete mock PostGIS collections (floodZones, noiseCorridors, sereneZones, smogZones, emergencyShelters). |
Reads from native spatialData.js offline database file. |
/api/route |
POST |
origin (Array [lng, lat]), destination (Array [lng, lat]), mode ("pulse"/"haven") |
GeoJSON path geometry coordinates, duration in minutes, distance in km, and computed empathyScore metadata. |
Haven mode intercepts errors and falls back to OSRM (unprotected route) setting fallbackUsed: true. |
/api/weather |
GET |
lat (Float), lon (Float) |
Temp, wind speed, precipitation, raining status, and weather code condition descriptive string. | Gracefully handles Open-Meteo failures: returns cached 34Β°C mock dataset setting fallback: true. |
/api/aqi |
GET |
lat (Float), lon (Float) |
PM2.5, PM10, AQI index score, label validation (Good/Unhealthy), hex colors, and station name. | Gracefully handles OpenAQ failures: returns a mock dataset from New Delhi station setting fallback: true. |
/api/overpass |
GET |
bbox (south,west,north,east) |
Array of JSON elements detailing building polygon coordinate arrays, heights, and coordinates of trees. | Gracefully handles Overpass API rate-limit errors: returns local mock buildings in Delhi setting fallback: true. |
The system pulls local PM2.5 measurements from monitoring stations. It runs the raw measurements through standard US-EPA breakpoint curves:
- π’ 0β50: Good
- π‘ 51β100: Moderate
- π 101β150: Unhealthy for Sensitive Groups
- π΄ 151β200: Unhealthy
- π£ 201β300: Very Unhealthy
- π€ 301+: Hazardous (Triggers Metro alternate suggestion recommendations)
Inputs from coordinate boundaries are queried through Overpass. The backend extracts height and building:levels tags. The React frontend computes vector projections for building footprints:
- Calculates solar azimuth and elevation angles depending on time.
- Projects building corners into shadow coordinates based on structural height.
- Paints translucent shadow canvases layer polygons on top of the Leaflet coordinate space.
Ensure that security policies are anchored appropriately.
Configure a .env file in the root backend folder to customize runtime endpoints:
# Backend Port Configuration
PORT=3001The backend includes CORS locks to secure the orchestrator:
- White-listed Origins: Dev servers (
http://localhost:5173,http://localhost:3000), Anchored production domains (e.g.*.vercel.app,*.netlify.appregex matches). - Permitted Methods:
GET,POSTendpoints exclusively.
This project is licensed under the MIT License - see the LICENSE details for terms.