Documentation

Understand how GreenGuard AI works.

Explore the platform architecture, environmental intelligence workflows, AI capabilities, and implementation patterns behind GreenGuard AI.

Overview

What is GreenGuard AI?

GreenGuard AI is an environmental intelligence platform that unifies real-time environmental monitoring, meteorological forecasting, AI-assisted analysis, citizen reporting, and municipal authority workflows into a single cohesive system.

Citizens

Access real-time AQI and weather indicators, submit geo-tagged complaints with photo evidence, track resolution progress, and interact with the AI assistant.

Authorities

Receive assigned complaints within departmental jurisdiction, review severity scores, record investigation notes, submit resolution evidence, and resolve cases.

Administrators

Triage and verify incoming citizen reports, route cases to appropriate authorities, manage monitored city parameters, and oversee system governance.

Quickstart

Getting Started

Key operational entry points across the platform for exploring data, submitting issues, and managing environmental workflows.

Capabilities

Core Platform Modules

Every module is designed to solve a specific facet of urban environmental monitoring, forecasting, decision-making, and public collaboration.

System Flow

How GreenGuard AI Works

From sensor ingestion and meteorological feeds to actionable municipal insights and citizen resolution workflows.

1

Data Collection & Ingestion

Weather observations and atmospheric metrics are pulled via Open-Meteo feeds, combined with localized citizen-submitted environmental reports.

2

Analytics & AI Processing

The platform computes pollutant sub-indices, EcoScores, and 7-day predictive trends, using Google Gemini for grounded contextual briefings.

3

Action & Governance

Insights are surfaced on the Smart Map and Dashboards, while complaints are triaged by administrators and assigned to authorities for resolution.

Environmental Data FeedsExpress NormalizationEcoScore & Trend EngineGemini AI Decision SupportCitizen & Authority Workflows
Engineering

Reference Architecture

The full-stack application architecture connecting the React frontend, Node.js API, MongoDB persistence layer, and external intelligence services.

  ┌─────────────────────────────────────────────────────────────────────────┐
  │                    React 19 + TypeScript Application                    │
  │     TanStack Router · TanStack Query · Tailwind CSS · MapLibre GL       │
  └────────────────────────────────────┬────────────────────────────────────┘
                                       │ HTTP / REST (JWT Auth & Cookies)
                                       ▼
  ┌─────────────────────────────────────────────────────────────────────────┐
  │                   Node.js / Express.js REST API Gateway                 │
  │     Security (Helmet, CORS) · Rate Limiting · Role Authorization (RBAC) │
  └──────────────┬───────────────────────────┬──────────────────────────┬───┘
                 │                           │                          │
                 ▼                           ▼                          ▼
  ┌──────────────────────────────┐ ┌───────────────────┐ ┌──────────────────┐
  │      MongoDB / Mongoose      │ │  Open-Meteo API   │ │ Google Gemini AI │
  │ Users · Complaints · Cities  │ │ Weather & AQI     │ │ 2.5 Flash Model  │
  │ Alerts · Reports · Audits    │ │ Forecast Feeds    │ │ Prompt Grounding │
  └──────────────────────────────┘ └───────────────────┘ └──────────────────┘
Intelligence

AI & Intelligence Layer

How GreenGuard AI leverages Google Gemini as a grounded decision-support layer.

Data-Grounded Prompting

To ensure accuracy and prevent hallucinations, all AI queries query the underlying MongoDB database and meteorological services first. Current pollutant numbers, temperature, historical baselines, and complaint context are directly passed into the Gemini model prompts.

Decision-Support Role

AI within GreenGuard AI functions as an assistive intelligence tool — summarizing complex time-series datasets, generating public health guidance, and explaining policy simulator impacts. Final municipal actions and governance approvals always remain with human operators.

Governance

Citizen → Administrator → Authority Workflow

The closed-loop resolution process ensuring every environmental issue is tracked, verified, and resolved with full accountability.

1

Citizen Submission

Citizens submit localized complaints with category, location coordinates, description, and optional photo evidence via Citizen Hub.

2

Administrator Triage & Review

Administrators review new reports in the governance dashboard, verify validity, classify severity, and assign them to the appropriate municipal department.

3

Authority Investigation

Assigned authority personnel view the complaint in their dashboard, conduct field investigation, update case notes, and record resolution details.

4

Admin Verification & Closure

Administrators review the submitted resolution evidence. Once approved, the case is marked resolved, and the citizen receives a status update.

5

Citizen Feedback Loop

The citizen reviews the resolution outcome and can either accept the resolution or request rework if the issue persists.

Data Architecture

Data Categories & Transparency

GreenGuard AI maintains explicit separation between observed physical readings, derived indices, forecasts, and AI analysis.

Category A

Observed Data

Direct meteorological measurements from Open-Meteo APIs (temperature, humidity, wind speed) and direct citizen report observations.

Category B

Derived Metrics

Standardized Air Quality Index (AQI), Water Quality Index (WQI), and city EcoScores calculated via deterministic backend scoring formulas.

Category C

Forecast Projections

7-day predictive weather and AQI models generated from meteorological services with confidence intervals.

Category D

AI Insights

Natural-language context, environmental summaries, and simulation policy explanations synthesized by Google Gemini models.

Stack

Technology Stack

Technologies, libraries, and frameworks powering the current implementation.

Frontend
  • • React 19 & TypeScript
  • • TanStack Router & Query
  • • Tailwind CSS 4
  • • MapLibre GL GIS maps
  • • Framer Motion & Lucide
Backend
  • • Node.js & Express.js
  • • TypeScript
  • • Helmet & CORS security
  • • Express-Rate-Limit
  • • Morgan logging
Database & Auth
  • • MongoDB & Mongoose
  • • JWT Token Authentication
  • • Bcrypt password hashing
  • • Role-Based Access (RBAC)
  • • Optional 2FA Challenge
AI & Services
  • • Google Gemini 2.5 Flash
  • • Data-Grounded Prompting
  • • Open-Meteo Weather APIs
  • • jsPDF Report Exporter
  • • Audit Trail Governance
API Reference

Backend REST Endpoints

Implemented REST endpoints available on the GreenGuard backend service.

Authentication
POST/api/auth/signup
Register a new user account
POST/api/auth/login
Authenticate credentials and issue JWT
GET/api/auth/me
Fetch profile of current authenticated user
POST/api/auth/2fa-challenge
Verify 2FA OTP for enabled accounts
Environmental & Forecast
GET/api/environmental/cities
List all active monitored cities
GET/api/environmental/cities/:cityId
Get real-time city pollutant metrics
GET/api/environmental/cities/:cityId/forecast
Get 7-day daily weather/AQI forecast
GET/api/environmental/cities/:cityId/map-data
Fetch GIS stations, zones, and hotspots
GET/api/forecast/:cityId
Retrieve detailed multi-day forecast model
Complaints & Workflow
GET/api/complaints
List and filter complaints with role scoping
POST/api/complaints
Submit a new geo-tagged complaint
POST/api/complaints/:id/images
Upload photo evidence for a complaint
POST/api/complaints/:id/verify
Admin verification of completed resolution
POST/api/complaints/:id/rework
Admin request for authority rework
AI & Intelligence
POST/api/copilot/chat
Send grounded environmental query to AI assistant
POST/api/copilot/health-advice
Generate health recommendations based on AQI
GET/api/copilot/insights
Get automated environmental summary insights
POST/api/simulator/ai-analysis
Evaluate policy scenario impact using AI
Alerts & Simulator
GET/api/alerts/active
List all currently triggered threshold alerts
POST/api/alerts
Create an advisory alert (authority/admin)
POST/api/simulator/run
Execute mathematical policy simulation
POST/api/simulator/compare
Compare multiple simulation parameter sets
Reports & Admin
GET/api/reports
List generated environmental reports
POST/api/reports/generate-ai-report
Generate full AI executive report
GET/api/reports/:id/download
Download generated report PDF
GET/api/admin/stats
Retrieve platform governance statistics
Security

Security & Access Control

Security controls implemented across the API, database, and client applications.

Role-Based Access (RBAC)

Granular access control enforcing strict permissions for Citizen, Authority, and Administrator roles across all routes and API controllers.

JWT & Session Security

Stateless JSON Web Tokens with expiration handling, bcrypt salted password hashing, and optional 2FA verification challenge workflows.

API Defense & Rate Limiting

Express rate limiters protect authentication endpoints, AI endpoints, and general API routes, combined with Helmet HTTP security headers.

See the platform live
Launch GreenGuard AI and explore every module.
Launch Platform