UrbanSense is a full-stack environmental intelligence and municipal decision-support dashboard designed for urban planners, municipal authorities, and sustainability teams. The application integrates real-time air quality metrics, arterial traffic congestion modeling, and Google Gemini AI to synthesize cross-domain urban interventions.
- Free OpenStreetMap Base Layer: Rendered with high-contrast, watermark-free OpenStreetMap tiles, requiring no third-party map API keys.
- Air Quality Sensor Overlay: Interactive monitoring stations color-coded by EPA AQI categories (Good, Moderate, Sensitive, Unhealthy, Very Unhealthy, Hazardous).
- Arterial Traffic Corridors: Polyline corridor overlays visualizing road speed, free-flow metrics, and congestion percentage (from clear greens to congested crimson).
- Bi-directional Inspector: Clicking any map sensor or roadway focuses granular telemetry (PM2.5, NO₂, O₃, CO, SO₂, congestion %, average speeds, and active incident alerts).
- Metropolitan Hub Strip: Quick-switch presets for global hubs including Los Angeles, New York, Chicago, San Francisco, London, Paris, Berlin, Delhi, Mumbai, Tokyo, Seoul, Singapore, Sydney, Toronto, and Dubai.
- Search Any City Worldwide: Integrated geocoding modal powered by open Nominatim geocoding. Enter any municipality on Earth to dynamically generate localized coordinate grids, monitoring arrays, and traffic corridors.
- OpenAQ v3 Integration: Server-side proxy (
/api/air-quality) that queries live monitoring stations around each city using the OpenAQ v3 API. - 12-Hour AQI Trend Chart: Visual history showing diurnal particulate fluctuations and peak pollution hours.
- Real-Time Traffic Engine: Live simulation tick that periodically adjusts roadway congestion and traffic flow to mirror real-world commuting cycles.
- Data-Grounded Reasoning: Supplies the AI model with comprehensive city telemetry snapshots (average AQI, peak particulate hotspots, corridor congestion percentages, and active incidents).
- Multi-Model Failover: Configured with a resilient model sequence (
gemini-3.1-flash-lite,gemini-3.8-flash,gemini-flash-latest) with timeout guards. - Continuous Availability: Includes a telemetry heuristic engine that ensures actionable mitigation strategies even during upstream network fluctuations.
- Frontend: React 18, TypeScript, Tailwind CSS, Lucide React, Leaflet (interactive maps)
- Backend: Node.js, Express, Vite middleware mode,
@google/genai(Google Gen AI SDK) - Geocoding & Tiles: OpenStreetMap, Nominatim API
- Data Feeds: OpenAQ v3 REST API, Simulated Real-Time Traffic Telemetry
- Node.js (v18 or higher)
- npm or bun
-
Clone or extract the repository:
git clone <repository-url> cd urbansense
-
Install dependencies:
npm install
-
Configure Environment Variables: Copy
.env.exampleto.envand provide your API keys:cp .env.example .env
# Required for AI advisor queries (Google AI Studio) GEMINI_API_KEY=your_gemini_api_key_here # Optional: For live global sensor stations (defaults to high-fidelity modeled data if omitted) OPENAQ_API_KEY=your_openaq_api_key_here
-
Start Development Server:
npm run dev
The application runs on
http://localhost:3000. -
Build for Production:
yarn install && yarn build node dist/server.cjs
GET /api/health: Health status and configured credentials telemetry.GET /api/air-quality?lat=:lat&lng=:lng&city=:city: Proxies OpenAQ v3 API queries to retrieve live particulate observations near target coordinates.POST /api/chat: Accepts{ message, snapshot }payload and returns structured urban planning recommendations.
MIT License. Designed for civic innovation and smart city research.