An open API service indexing awesome lists of open source software.

https://github.com/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.
https://github.com/minhe51805/urbanreflex

air-quality citizen-reporting fastapi fiware geospatial ml-classification nextjs ngsi-ld open-data orion-ld smart-city urban-infrastructure

Last synced: 3 months ago
JSON representation

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.

Awesome Lists containing this project

README

          


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?](#what-is-urbanreflex)
- [What's New in v0.2.0](#-whats-new-in-v020)
- [Key Features](#-key-features)
- [Quick Start](#-quick-start)
- [Demo Credentials](#-demo-credentials)
- [Technology Stack](#๏ธ-technology-stack)
- [System Architecture](#-system-architecture)
- [Project Structure](#-project-structure)
- [Just Commands Reference](#-just-commands-reference)
- [Documentation](#-documentation)
- [Project Status](#-project-status)
- [Contributing](#-contributing)
- [Support and Organization](#-support-and-organization)
- [License](#-license)

---

## 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](./CHANGELOG.md) for full release notes.

---

## ๐Ÿš€ Quick Start

### Prerequisites

```bash
โœ… Just task runner # https://just.systems/
โœ… Docker Desktop # https://www.docker.com/
โœ… 8GB RAM minimum
```

### Installation

```bash
# 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:
>
> ```bash
> 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:

```powershell
# 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:

```bash
just db-start
just db-logs # Check for errors
```

### Environment Variables (Optional)

Click to expand configuration

Edit `.env` for backend:

```bash
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`:

```bash
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

```bash
just install # Install UV + backend deps + frontend deps (one command!)
just setup-env # Create .env and src/frontend/.env.local from examples
```

### Development

```bash
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

```bash
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

```bash
just format # Format all code (Black + Prettier)
just lint # Run linters (Flake8 + ESLint)
just test # Run backend tests
```

### Utilities

```bash
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](./docs/API_REFERENCE.md) | Complete REST API documentation |
| [Architecture](./docs/ARCHITECTURE.md) | System design and components |
| [Development Setup](./docs/DEVELOPMENT_SETUP.md) | Local development guide |
| [Data Model](./docs/DATA_MODEL_AND_ENTITIES.md) | NGSI-LD entity definitions |
| [User Guide](./docs/USER_GUIDE.md) | End-user manual |
| [Code Style Guide](./docs/CODE_STYLE_GUIDE.md) | 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](https://img.shields.io/github/stars/minhe51805/UrbanReflex?style=social) |
| ๐Ÿด **Forks** | ![GitHub forks](https://img.shields.io/github/forks/minhe51805/UrbanReflex?style=social) |
| ๐Ÿ‘๏ธ **Watchers** | ![GitHub watchers](https://img.shields.io/github/watchers/minhe51805/UrbanReflex?style=social) |
| ๐Ÿ‘ฅ **Contributors** | ![GitHub contributors](https://img.shields.io/github/contributors/minhe51805/UrbanReflex) |
| ๐Ÿ“ **Commits** | ![GitHub commit activity](https://img.shields.io/github/commit-activity/t/minhe51805/UrbanReflex) |
| ๐Ÿ› **Issues** | ![GitHub issues](https://img.shields.io/github/issues/minhe51805/UrbanReflex) ![GitHub closed issues](https://img.shields.io/github/issues-closed/minhe51805/UrbanReflex?color=success) |
| ๐ŸŽฏ **Pull Requests** | ![GitHub pull requests](https://img.shields.io/github/issues-pr/minhe51805/UrbanReflex) ![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/minhe51805/UrbanReflex?color=success) |
| ๐Ÿ“… **Last Commit** | ![GitHub last commit](https://img.shields.io/github/last-commit/minhe51805/UrbanReflex) |
| ๐Ÿ“ฆ **Code Size** | ![GitHub code size](https://img.shields.io/github/languages/code-size/minhe51805/UrbanReflex) |
| ๐Ÿ“œ **License** | ![GitHub license](https://img.shields.io/github/license/minhe51805/UrbanReflex) |

---

## ๐Ÿ“„ License

This project is licensed under the **GNU General Public License v3.0** - see the [LICENSE](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](https://github.com/minhe51805/UrbanReflex) โ€ข [๐Ÿ“š Documentation](https://minhe51805.github.io/UrbanReflex/) โ€ข [๐Ÿ› Report Bug](https://github.com/minhe51805/UrbanReflex/issues) โ€ข [๐Ÿ’ฌ Discussions](https://t.me/+o1X9iR9j7_czYmE1)