dheerajpatel3448w/Ecowatch-geo-intelligence
GitHub: dheerajpatel3448w/Ecowatch-geo-intelligence
Stars: 0 | Forks: 0
# 🌍 EcoWatch: Geospatial Intelligence & Threat Detection System
**EcoWatch** is an advanced satellite threat detection platform built to combat deforestation, illegal mining, and ecological damage. It combines a Next.js command-center UI, Apache Kafka for high-throughput event streaming, and Python-based Machine Learning (Qwen2-VL) to analyze satellite imagery in real-time.
## 🚀 Key Features
- **🌐 Global Threat Radar:** A 3D geospatial dashboard with real-time alerts, metrics, and threat mapping.
- **🛰️ Satellite AI Analysis:** Integrates the Qwen2-VL-2B-Instruct Vision-Language Model to automatically detect deforestation and environmental anomalies from satellite imagery (NDVI analysis).
- **📡 Mission Control (Zones):** Draw and manage surveillance zones directly on a map using React-Leaflet. Trigger manual or automated ML scans for specific coordinates.
- **⚖️ Legal & Carbon Engine:** Calculates exact Carbon loss and generates official **PDF Legal Evidence Reports** automatically for FIR submission.
- **📱 Field Operations Portal:** A mobile-first UI for ground rangers to upload evidence photos, matched with GPS locations, which are also verified locally by AI.
- **⚡ Real-Time Streaming:** End-to-end Kafka integration handling heavy ML workloads asynchronously between Node.js and Python.
## 🏗️ Architecture & Tech Stack
The platform is divided into three main microservices, heavily utilizing containerization for the infrastructure.
### 1. Frontend (`/ecowatch`)
- **Framework:** Next.js (App Router), React 19
- **Styling:** Tailwind CSS v4, Framer Motion (Military/Command-Center Dark Theme, Glassmorphism)
- **Mapping & 3D:** React-Leaflet, Mapbox-GL, Three.js, React-Three-Fiber
- **Data Visualization:** Recharts
- **Real-Time:** Socket.IO Client
### 2. API Backend (`/node-service`)
- **Runtime:** Node.js, Express.js
- **Database:** MongoDB (Mongoose)
- **Message Broker:** KafkaJS (Producer/Consumer)
- **Features:** JWT Authentication, Role-Based Access Control (Admin, Analyst, Ranger), PDFKit (Legal Reports), Multer (Image Uploads)
### 3. ML Service (`/ml-service`)
- **Runtime:** Python 3.11+, FastAPI
- **AI Models:** Qwen2-VL-2B-Instruct, HuggingFace Transformers, PyTorch
- **Message Broker:** Confluent-Kafka
- **Features:** Satellite image processing, NDVI physics logic, local photo validation
### 4. Infrastructure (`docker-compose.yml`)
- **Zookeeper & Kafka:** Confluent images for event streaming.
- **MongoDB:** Database storage.
## 📂 Project Structure
ecowatch/
├── ecowatch/ # Next.js Frontend UI
├── node-service/ # Express API Backend
├── ml-service/ # FastAPI Python Machine Learning Service
├── docker-compose.yml # Infrastructure configuration (Kafka, Mongo)
├── ECOWATCH_HANDOFF.md # Developer architectural notes
└── README.md # Project documentation
## ⚙️ Setup & Installation
### 1. Start Infrastructure (Docker)
Ensure Docker Desktop is running, then spin up MongoDB, Zookeeper, and Kafka.
docker-compose up -d
### 2. Setup Node.js API Service
cd node-service
npm install
npm run dev
*(Runs on `http://localhost:5000`)*
### 3. Setup Python ML Service
*Note: Run locally to utilize system GPU or CPU for heavy ML processing.*
cd ml-service
python -m venv .venv
# Activate venv: .venv\Scripts\activate (Windows) OR source .venv/bin/activate (Mac/Linux)
pip install -r requirements.txt
uvicorn api.app:app --host 0.0.0.0 --port 8001
*(Runs on `http://localhost:8001`)*
### 4. Setup Next.js Frontend
cd ecowatch
npm install
npm run dev
*(Runs on `http://localhost:3000`)*
## 🔐 Environment Variables
You will need `.env` files in each respective directory. Here is a basic template based on the architecture:
**`/node-service/.env`**
PORT=5000
MONGO_URI=mongodb://localhost:27017/ecowatch
JWT_SECRET=ecowatch_production_secret_change_me
KAFKA_BROKER=localhost:9092
**`/ml-service/.env`**
KAFKA_BROKER=localhost:9092
KAFKA_GROUP=ml-workers
SH_CLIENT_ID=your_sentinel_hub_client_id
SH_CLIENT_SECRET=your_sentinel_hub_client_secret
HF_TOKEN=your_huggingface_token
MODEL_NAME=Qwen/Qwen2-VL-2B-Instruct
LOG_LEVEL=INFO
## 👨💻 Developer & Maintainer
Built by **Dheeraj Patel** (MERN Stack & AI Developer).