minhe51805/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.
UrbanReflex
A smart city intelligence platform that bridges fragmented urban data sources into a unified NGSI-LD ecosystem, empowering communities and city managers with real-time infrastructure insights and open data access
Explore the platform ยป
๐ Report Bug
|
โจ Request Feature
|
๐ฌ Join Discussion
|
๐ Documentation
โจ 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
Expand contents
What is UrbanReflex?
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.
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.
๐ 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 minimumInstallation
# 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 ComposeDone! ๐
- 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
โ UV installation error on Windows
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โ Database connection error
Make sure databases are running:
just db-start
just db-logs # Check for errorsEnvironment Variables (Optional)
Click to expand configuration
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 dataEdit src/frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8000App 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
๐ฆ Project Structure
UrbanReflex/
โโโ src/
โ โโโ backend/ # FastAPI Backend
โ โ โโโ app.py # Main application entry
โ โ โโโ routers/ # API endpoint definitions
โ โ โโโ models/ # Database models
โ โ โโโ schemas/ # Pydantic validation schemas
โ โ โโโ ai_service/ # Gemini AI & Pinecone integration
โ โ โโโ utils/ # Utility functions
โ โโโ frontend/ # Next.js 16 Frontend
โ โโโ app/ # App Router pages
โ โโโ components/ # React components
โ โโโ contexts/ # State management
โ โโโ lib/ # API clients & utilities
โ โโโ types/ # TypeScript definitions
โโโ scripts/ # Data fetching & processing scripts
โโโ docs/ # Project documentation
โโโ open_data/ # Open datasets (GeoJSON, NDJSON)
โโโ schemas/ # JSON schemas for data validation
โโโ .justfile # Just task automation recipes
โโโ pyproject.toml # Python dependencies (PEP 518)
โโโ docker-compose.yml # Container orchestration
โโโ LICENSE # GPL-3.0 license
๐ Just Commands Reference
Installation & Setup
just install # Install UV + backend deps + frontend deps (one command!)
just setup-env # Create .env and src/frontend/.env.local from examplesDevelopment
just dev # Start databases + show instructions for backend/frontend
just backend-install # Install backend dependencies only
just backend-dev # Start backend API (port 8000)
just frontend-install # Install frontend dependencies only
just frontend-dev # Start frontend app (port 3000)Database Management
just db-start # Start MongoDB + Orion-LD
just db-stop # Stop databases
just db-restart # Restart databases
just db-logs # View database logs
just db-clean # Remove all database data (with confirmation)Code Quality
just format # Format all code (Black + Prettier)
just lint # Run linters (Flake8 + ESLint)
just test # Run backend testsUtilities
just info # Show project info, ports, and quick start guide
just health # Check backend health endpoint
just clean # Clean build artifacts and cache
just stop-all # Stop all running services
just code # Open project in VS Code๐ Documentation
| Document | Description |
|---|---|
| API Reference | Complete REST API documentation |
| Architecture | System design and components |
| Development Setup | Local development guide |
| Data Model | NGSI-LD entity definitions |
| User Guide | End-user manual |
| Code Style Guide | Coding conventions |
๐ Use Cases
For Citizens
- Click any road segment on the map to view complete infrastructure information: weather conditions, air quality, streetlights, and nearby public facilities
- Report infrastructure issues (broken streetlights, potholes, waste dumping, flooding) with automatic GPS location and photo documentation
- Track real-time resolution status of submitted reports with automatic updates and notifications
- Explore open data to gain deeper insights about your neighborhood and make informed decisions
For City Officials
- Real-time dashboard displaying all citizen reports on an interactive map with powerful filtering capabilities
- AI-powered automatic issue classification and priority adjustment based on proximity to schools, hospitals, and sensitive areas
- Data-driven task management and maintenance assignment, optimizing resource allocation and response times
- Export open data in multiple formats (NDJSON, CSV, GeoJSON) for deep analysis and urban planning
For Developers
- Access complete NGSI-LD entities (RoadSegment, WeatherObserved, AirQualityObserved, Streetlight, PointOfInterest, CitizenReport) via standard REST API
- Build custom applications leveraging Linked Open Data (LOD) relationships between entities
- Integrate with other smart city systems through FiWARE Smart Data Models and SOSA/SSN ontology compliance
- Contribute to open-source smart city platform with comprehensive, ready-to-use open datasets
Contributing
๐ Contributing Guidelines
We are excited that you are interested in contributing to this project! Before submitting your contribution, please make sure to take a moment and read through the following guidelines:
Read through our contributing guidelines to learn about our submission process, coding rules, and more.
๐ Want to Help?
Want to report a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.
Support and Organization
๐ Project Stats
| Metric | Badge |
|---|---|
| ๐ Stars | |
| ๐ด Forks | |
| ๐๏ธ Watchers | |
| ๐ฅ Contributors | |
| ๐ Commits | |
| ๐ Issues | |
| ๐ฏ Pull Requests | |
| ๐ Last Commit | |
| ๐ฆ Code Size | |
| ๐ License |
๐ License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Key Points:
- โ Free to use, modify, and distribute
- โ Source code must be made available
- โ Modifications must use same GPL-3.0 license
- ๐ Full license: https://www.gnu.org/licenses/gpl-3.0.html
UrbanReflex v0.2.0 โ Smart City Intelligence Platform
๐ Homepage โข ๐ Documentation โข ๐ Report Bug โข ๐ฌ Discussions
