UrbanReflex
UrbanReflex is an open-source smart city platform that transforms road segments into linked data nodes, integrating environmental monitoring, infrastructure status, and citizen reports. AI-powered classification and prioritization help city teams manage issues efficiently, while NGSI-LD open data ensures transparency and interoperability.
Install / Use
/learn @minhe51805/UrbanReflexREADME
✨ Highlights
- 🌍 Real-time air quality and environmental monitoring (NGSI-LD aligned)
- 📝 Citizen-Powered Infrastructure Reporting with photo uploads & geolocation
- 🤖 Automated classification and prioritization for city operations & RAG system
- 🏛️ NGSI-LD Compliant Smart City Data Models (ETSI standard)
- 📂 Open Data Access via public API & standard exports: GeoJSON, NDJSON, CSV
- ⚡ One-Command Setup with Just task runner & UV package manager
- 🔐 Access control for citizens, city staff, and admins
📋 Table of Contents
<details> <summary>Expand contents</summary>- What is UrbanReflex?
- What's New in v0.2.0
- Key Features
- Quick Start
- Demo Credentials
- Technology Stack
- System Architecture
- Project Structure
- Just Commands Reference
- Documentation
- Project Status
- Contributing
- Support and Organization
- License
What is UrbanReflex?
<p align="justify"> UrbanReflex is an open-source smart city platform designed to address critical urban challenges through integrated data-driven solutions, combining real-time environmental monitoring with citizen engagement tools for transparent, efficient urban governance. </p> <blockquote> <p align="justify"> Built on NGSI-LD standards, the platform unifies infrastructure data, air quality monitoring, and citizen reports into actionable intelligence. Through open data access, AI-powered analytics, and real-time insights, it enables communities and city managers to make informed decisions that drive sustainable urban development and transparent governance. </p> </blockquote>🆕 What's New in v0.2.0
This release focuses on developer experience improvements, automation, and production readiness.
⚡ One-Command Setup
- Just Task Runner: 16+ pre-configured recipes for all development tasks
- UV Auto-Installation:
just installautomatically installs UV + all dependencies - Dual Environment Setup: Separate configuration for backend (
.env) and frontend (.env.local) - Zero Configuration: No manual dependency installation required
🌐 Multi-Language Support
- 12 Languages: English, Vietnamese, Spanish, French, German, Chinese, Japanese, Korean, Arabic, Russian, Portuguese, Hindi
- Google Translate Integration: Real-time UI translation without page reload
- Language Persistence: Selected preference stored in browser
🔧 Developer Experience
- Updated Dependencies: Next.js 16.0.7, Prettier 3.2.5
- Code Quality Tools: Black, Flake8, isort, ESLint, Prettier pre-configured
- Pre-commit Hooks: Automatic code quality checks with Husky
- Comprehensive Documentation: Complete setup guide with troubleshooting
🐛 Bug Fixes
- Fixed
ModuleNotFoundErrorfor backend models package - Fixed Just command PowerShell syntax errors on Windows
- Fixed frontend environment file location
See CHANGELOG.md for full release notes.
🚀 Quick Start
Prerequisites
✅ Just task runner # https://just.systems/
✅ Docker Desktop # https://www.docker.com/
✅ 8GB RAM minimum
Installation
# 1. Clone repository
git clone https://github.com/minhe51805/UrbanReflex.git
cd UrbanReflex
# 2. Install Just (if not already installed)
winget install Casey.Just # Windows
brew install just # macOS
cargo install just # Linux
# 3. Install all dependencies (one command!)
just install
# ✅ Auto-installs UV, Python packages, npm packages
# 4. Setup environment files
just setup-env
# ✅ Creates .env and src/frontend/.env.local from examples
# 5. Start all services (one command!)
just dev
# ✅ Starts MongoDB, Orion-LD, and Scheduler with Docker Compose
Done! 🎉
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000/docs
- Orion-LD: http://localhost:1026
Note: To run backend/frontend locally (without Docker), use separate terminals:
just backend-dev # Terminal 2: Backend dev server just frontend-dev # Terminal 3: Frontend dev server
Troubleshooting
<details> <summary>❌ UV installation error on Windows</summary>If just install fails with UV path errors:
# Option 1: Restart terminal and try again
just install
# Option 2: Install backend separately
just backend-install
# Option 3: Manual UV installation
irm https://astral.sh/uv/install.ps1 | iex
# Restart terminal, then: uv sync --all-extras
</details>
<details>
<summary>❌ Database connection error</summary>
Make sure databases are running:
just db-start
just db-logs # Check for errors
</details>
Environment Variables (Optional)
<details> <summary>Click to expand configuration</summary>Edit .env for backend:
GEMINI_API_KEY=your-key # For AI chatbot
PINECONE_API_KEY=your-key # For vector search
OPENAQ_API_KEY=your-key # For real air quality data
Edit src/frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8000
</details>App works without API keys (uses mock data)
🛠️ Technology Stack
Backend
| Technology | Purpose | | ---------------- | --------------------------------------- | | FastAPI | High-performance async API framework | | Python 3.10+ | Backend runtime | | MongoDB | Document database for users and reports | | Orion-LD | NGSI-LD compliant context broker | | Redis | In-memory caching and sessions | | Gemini AI | Natural language understanding | | Pinecone | Vector search for semantic similarity |
Frontend
| Technology | Purpose | | ----------------- | ------------------------------- | | Next.js 16 | React framework with App Router | | TypeScript | Type-safe development | | Tailwind CSS | Utility-first styling | | MapLibre GL | Interactive WebGL mapping | | Chart.js | Data visualization | | Framer Motion | Smooth UI animations |
Infrastructure
| Technology | Purpose | | ------------------ | --------------------------- | | Docker Compose | Multi-service orchestration | | Just | Task automation | | UV | Fast Python package manager | | Husky | Git hooks for code quality |
📊 System Architecture
<img loading="lazy" src="https://media.discordapp.net/attachments/1048439092154740836/1447263130039357480/Gemini_Generated_Image_vht8b3vht8b3vht8.png?ex=6936fc53&is=6935aad3&hm=727d081965f355ce91da79f44b8067d930f44e06ec2cb5850f763d219f9435d1&=&format=webp&quality=lossless" alt="UrbanReflex Banner" width="100%">📦 Project Structure
UrbanReflex/
├── src/
│ ├── backend/ # FastAPI Backend
│ │ ├── app.py # Main application entry
│ │ ├── routers/ # API endpoint definitions
│ │ ├── models/ # Database models
│ │ ├── schemas/ # Pydantic validation schemas
│
