Skip to content

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.

License

Notifications You must be signed in to change notification settings

minhe51805/UrbanReflex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

UrbanReflex Logo

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

UrbanReflex version Release Status UrbanReflex issues UrbanReflex license FastAPI Next.js NGSI-LD

UrbanReflex Banner


✨ 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 install automatically 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 ModuleNotFoundError for 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! πŸŽ‰

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 errors

Environment 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 data

Edit src/frontend/.env.local:

NEXT_PUBLIC_API_URL=http://localhost:8000

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

UrbanReflex Banner


πŸ“¦ 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 examples

Development

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 tests

Utilities

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

HUTECH University Β Β Β  VFOSSA Β Β Β  Vietnam OLP


πŸ“ˆ Project Stats

Metric Badge
🌟 Stars GitHub stars
🍴 Forks GitHub forks
πŸ‘οΈ Watchers GitHub watchers
πŸ‘₯ Contributors GitHub contributors
πŸ“ Commits GitHub commit activity
πŸ› Issues GitHub issues GitHub closed issues
🎯 Pull Requests GitHub pull requests GitHub closed pull requests
πŸ“… Last Commit GitHub last commit
πŸ“¦ Code Size GitHub code size
πŸ“œ License GitHub license

πŸ“„ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Key Points:


UrbanReflex v0.2.0 β€” Smart City Intelligence Platform

🏠 Homepage β€’ πŸ“š Documentation β€’ πŸ› Report Bug β€’ πŸ’¬ Discussions

About

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.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •