Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 ClimaVoice

AI-Powered Environmental Reporting Platform for Climate Justice

PROXOCORIS International Competition 2026 Category: Web Development | Subtema: AI for Climate Justice and Social Resilience Team: Ngawi Empire

🌐 Live Demo: https://demo.xlabscloud.com/climavoice/ πŸ“¦ Repository: https://github.com/yon3zu/climavoice


πŸ“‹ Overview

ClimaVoice is a community-driven web platform that empowers Indonesian citizens to report, monitor, and address environmental issues using the power of Artificial Intelligence. Every report submitted is automatically analyzed by Google Gemini AI to assess severity, provide impact assessments, and recommend follow-up actions β€” bridging the gap between community voices and real-world environmental solutions.


✨ Key Features

πŸ—ΊοΈ Environmental Reporting

  • Submit reports with title, description, category, photo evidence, and GPS location pinned on an interactive Leaflet.js map
  • 9 categories: Water Pollution, Air Pollution, Deforestation, Flood, Wildfire, Industrial Waste, Illegal Dumping, Soil Erosion, and Others
  • Real-time view count and community upvote support system
  • Comment and discussion on each report

πŸ€– AI Integration (Google Gemini via OpenRouter)

  • Auto-Analysis on Submit β€” Every new report is instantly analyzed by AI upon submission
  • AI assesses: environmental impact, severity level (Critical / High / Medium / Low), recommended actions, and risk factors
  • AI Climate Assistant β€” Conversational AI chatbot trained on ClimaVoice context, Indonesian environmental law (UU PPLH), and climate knowledge. Knows how to guide users to report through the platform
  • Chat history stored per session, supports markdown-formatted responses

🌫️ Real-Time Air Quality

  • Live Air Quality Index (AQI) widget on each report detail page
  • Powered by AQICN API β€” shows AQI value, health level, dominant pollutant, and nearest monitoring station
  • Automatically fetched based on report's GPS coordinates

πŸ† Leaderboard

  • 3 ranking tabs: Most Reports, Most Community Support (Upvotes), Most Resolved Issues
  • Visual podium for Top 3 with πŸ₯‡πŸ₯ˆπŸ₯‰ medals
  • Automatic badge system: πŸ”° Pemula β†’ 🌱 Pelapor Aktif β†’ 🌿 Aktivis Hijau β†’ ⚑ Pejuang Iklim β†’ 🌍 Legenda Iklim
  • "Your Rank" highlight for logged-in users

πŸ“„ Export PDF

  • Generate a clean, print-optimized PDF for any report
  • Includes: photo evidence, AI analysis, GPS coordinates, Google Maps link, and ClimaVoice branding
  • Useful for forwarding reports to government agencies (DLHK, BKSDA, KLHK)

πŸ›‘οΈ Admin Panel

  • Full report management: view all reports, change status (Pending β†’ Verified β†’ In Progress β†’ Resolved)
  • Delete reports with cascade (removes upvotes, comments, and photo files)
  • Stats overview: total, pending, critical reports
  • Real-time inline status update via AJAX β€” no page reload

πŸ‘€ User Management

  • Secure registration & login with bcrypt password hashing
  • Profile settings: name, email, bio
  • Password change with strength indicator
  • Personal dashboard with report stats and action buttons (view, edit, delete)

πŸ“± Progressive Web App (PWA)

  • Installable on mobile homescreen (Android & iOS)
  • Service worker for asset caching and offline fallback page
  • App shortcuts: Report, AI Chat, Leaderboard

πŸ› οΈ Tech Stack

Layer Technology
Frontend HTML5, Tailwind CSS (CDN), Vanilla JavaScript
Backend PHP 8.x (no framework, custom router)
Database MySQL 8 with PDO
AI Google Gemini 2.0 Flash via OpenRouter API
Maps Leaflet.js + OpenStreetMap
Air Quality AQICN API (World Air Quality Index)
PDF Export Browser Print API with print-optimized CSS
PWA Web App Manifest + Service Worker
Routing Apache mod_rewrite (.htaccess) β€” clean URLs

πŸ“ Project Structure

climavoice/
β”œβ”€β”€ index.php               # Main router
β”œβ”€β”€ manifest.json           # PWA manifest
β”œβ”€β”€ database.sql            # Full DB schema + seed data
β”œβ”€β”€ .htaccess               # Clean URL routing
β”‚
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ config.php          # App constants, API keys
β”‚   └── database.php        # PDO singleton connection
β”‚
β”œβ”€β”€ includes/
β”‚   β”œβ”€β”€ functions.php       # Helpers: upload, AI call, auth, etc.
β”‚   β”œβ”€β”€ header.php          # Navbar, PWA tags, flash messages
β”‚   └── footer.php          # Footer, Leaflet JS, service worker reg
β”‚
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ home.php            # Landing page with map & stats
β”‚   β”œβ”€β”€ reports.php         # Report listing with filters
β”‚   β”œβ”€β”€ report-detail.php   # Report detail, AI analysis, AQI widget
β”‚   β”œβ”€β”€ report-edit.php     # Edit report (owner/admin)
β”‚   β”œβ”€β”€ report-print.php    # Print/PDF export page
β”‚   β”œβ”€β”€ submit.php          # Submit new report
β”‚   β”œβ”€β”€ dashboard.php       # User dashboard
β”‚   β”œβ”€β”€ profile.php         # Profile & password settings
β”‚   β”œβ”€β”€ admin.php           # Admin panel
β”‚   β”œβ”€β”€ leaderboard.php     # Community leaderboard
β”‚   β”œβ”€β”€ chat.php            # AI Climate Assistant chat
β”‚   β”œβ”€β”€ login.php           # Login
β”‚   β”œβ”€β”€ register.php        # Registration
β”‚   β”œβ”€β”€ about.php           # About ClimaVoice
β”‚   β”œβ”€β”€ terms.php           # Terms & Conditions
β”‚   β”œβ”€β”€ privacy.php         # Privacy Policy
β”‚   └── 404.php             # Not found page
β”‚
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ ai-analyze.php      # AI report analysis endpoint
β”‚   β”œβ”€β”€ ai-chat.php         # AI chat endpoint
β”‚   β”œβ”€β”€ air-quality.php     # AQICN proxy endpoint
β”‚   β”œβ”€β”€ auth.php            # Register/login API
β”‚   β”œβ”€β”€ comment.php         # Comment submit
β”‚   β”œβ”€β”€ delete-report.php   # Delete report (owner/admin)
β”‚   β”œβ”€β”€ reports.php         # Reports API
β”‚   β”œβ”€β”€ update-status.php   # Admin status update
β”‚   └── upvote.php          # Upvote toggle
β”‚
└── assets/
    β”œβ”€β”€ css/style.css       # Custom CSS (no @apply β€” plain CSS)
    β”œβ”€β”€ js/
    β”‚   β”œβ”€β”€ main.js         # Scroll animations, char counters
    β”‚   └── sw.js           # Service worker
    β”œβ”€β”€ icons/              # PWA icons (192px, 512px)
    └── uploads/            # User-uploaded report photos

πŸš€ Installation

Requirements

  • PHP 8.0+
  • MySQL 8.0+
  • Apache with mod_rewrite enabled
  • AllowOverride All in Apache config

Steps

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/climavoice.git

2. Place in web server root

/htdocs/climavoice/   (XAMPP)
/var/www/html/climavoice/   (Linux Apache)

3. Import database

mysql -u root -p < database.sql

Or import via phpMyAdmin β€” creates database climavoice with all tables and demo data.

4. Configure the app

Edit config/config.php:

define('APP_URL',          'http://localhost/climavoice');
define('BASE_PATH',        '/climavoice');
define('OPENROUTER_API_KEY', 'your-openrouter-api-key');
define('AQICN_TOKEN',       'your-aqicn-token');

Get API keys:

5. Set upload permissions

chmod 777 assets/uploads/

6. Enable Apache mod_rewrite (Linux)

sudo a2enmod rewrite
sudo systemctl restart apache2

7. Access the app

http://localhost/climavoice

Default Admin Account

Email    : admin@climavoice.id
Password : password

πŸ”‘ Environment Notes

Config Value
AI Model google/gemini-2.0-flash-001
Max Upload Size 5 MB (JPG, PNG, WebP)
File Validation Magic bytes (cross-platform, no finfo dependency)
Password Hashing bcrypt via password_hash()
CSRF Protection Token on all POST forms
Session PHP native sessions

πŸ“Š Database Schema

Table Description
users id, name, email, password (bcrypt), role, bio, created_at
reports id, user_id, title, description, category, location_name, location_lat, location_lng, photo, status, ai_analysis, ai_severity, upvote_count, view_count, created_at, updated_at
report_upvotes id, report_id, user_id β€” unique per user per report
comments id, report_id, user_id, content, created_at
chat_messages id, session_key, user_id, role, content, created_at

All foreign keys use ON DELETE CASCADE.


πŸ” Security Features

  • CSRF tokens on all forms
  • Prepared statements (PDO) β€” no SQL injection
  • bcrypt password hashing
  • Magic bytes file validation (not relying on finfo/MIME)
  • Role-based access control (admin vs user)
  • XSS prevention via htmlspecialchars() on all output
  • File upload restricted to JPG/PNG/WebP with size limit

🌐 Cross-Platform Compatibility

Tested and verified to work on:

  • βœ… macOS (XAMPP)
  • βœ… Windows (XAMPP)
  • βœ… Linux (Apache2)

Key cross-platform decisions:

  • Magic bytes instead of finfo for file validation
  • dirname(__DIR__) for path resolution (no hardcoded separators)
  • utf8mb4 MySQL charset
  • No OS-specific PHP extensions required

πŸ“± PWA Support

ClimaVoice is installable as a Progressive Web App:

  • Add to homescreen on Android (Chrome) and iOS (Safari)
  • Offline fallback page when no internet connection
  • App shortcuts for quick access to key features
  • Theme color #16a34a (ClimaVoice green)

πŸ—ΊοΈ Roadmap

  • Heatmap layer on main map (Leaflet.heat)
  • Public analytics dashboard with Chart.js
  • Dark mode toggle
  • Email notifications on report status change
  • AI report similarity detection (prevent duplicates)
  • Multi-language support (ID/EN)
  • Open API for third-party access

πŸ“œ License & Attribution

  • Tailwind CSS β€” MIT License (CDN)
  • Leaflet.js β€” BSD 2-Clause License
  • OpenStreetMap β€” ODbL License
  • Google Gemini β€” via OpenRouter API (Google Terms of Service)
  • AQICN β€” World Air Quality Index API

All code in this repository is original work by Team Ngawi Empire.


πŸ‘₯ Team

Ngawi Empire PROXOCORIS International Competition 2026 Category: Web Development Subtema: AI for Climate Justice and Social Resilience


"Suara Komunitas untuk Keadilan Iklim" ClimaVoice β€” Bridging Gaps: Code for Earth, Intelligence for Justice, and Sustainability for Shaping Tomorrow

About

Proxocoris 2026

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages