A comprehensive waste management solution leveraging AI for waste classification, IoT-powered smart bin monitoring, real-time collection tracking, and community engagement. Built for smart cities and environmentally conscious communities.
- ๐ Frontend Application: https://smartwaste360-frontend.vercel.app/
- ๐ง Backend API: https://smartwaste360-backend.onrender.com
- ๐ API Health Check: https://smartwaste360-backend.onrender.com/health
- Real-time waste type detection powered by Google Gemini AI
- Camera integration for instant waste identification
- Supports multiple categories: Plastic, Paper, Glass, Metal, Organic, E-waste, Textile
- Confidence scoring and disposal recommendations
- ESP32 + HC-SR04 ultrasonic sensor for real-time bin fill-level detection
- Live dashboard with fill percentage, estimated weight, and historical charts
- Automatic collection point status updates from sensor data
- Smart-send: data transmitted only when fill level changes (reduces bandwidth)
- Median filtering for noise-resistant sensor readings
- API key authentication for secure device communication
- Real-time colony and collection point mapping with Leaflet
- Location-based waste collection scheduling
- Route optimization for collectors using TSP solver with 2-opt improvement
- Traffic-aware route planning with time-of-day adjustments
- Users: Register, classify waste, book collections, track points, view waste history
- Collectors: Manage pickups, schedule collections, view optimized routes, analytics dashboard
- Admins: System management, user oversight, analytics, system health monitoring
- Comprehensive waste collection statistics and dashboards
- Colony-wise performance tracking and leaderboards
- Environmental impact tracking (COโ saved, weight recycled)
- Weekly impact summary reports
- 7 notification types: reminders, achievements, colony threshold alerts, collection scheduled/completed, weekly summaries, streak milestones
- Automated inactivity reminders for engagement
- Colony threshold alerts when bins are near capacity
- Points-based reward system with configurable points per waste type
- Colony leaderboards and user rankings
- Achievement system with streak tracking
- Colony-based competition for waste reduction
- Visit SmartWaste360
- Register a new account
- Start classifying waste with your camera
- Book waste collections in your area
- Go to Collector Login
- Use your collector credentials
- View available pickups on the map
- Use the pickup scheduler for optimized routes
- Complete collections and update status
- Access Admin Panel
- Login with admin credentials
- Manage collectors, view analytics, oversee system health
smartwaste360/
โโโ app.py # Flask app factory (API v6.0.0)
โโโ start_app.py # Automated startup script
โโโ wsgi.py # WSGI entry point (Gunicorn)
โโโ Procfile # Render deployment command
โโโ render.yaml # Render service config
โโโ vercel.json # Vercel deployment config
โโโ Dockerfile # Container build
โ
โโโ backend/
โ โโโ config/
โ โ โโโ database.py # PostgreSQL connection manager
โ โโโ routes/ # 20 Flask Blueprints
โ โ โโโ auth.py # User/Collector/Admin authentication
โ โ โโโ waste.py # Waste classification (Gemini AI)
โ โ โโโ booking.py # Collection booking system
โ โ โโโ collector.py # Collector operations
โ โ โโโ admin.py # Admin dashboard endpoints
โ โ โโโ analytics.py # Analytics & reporting
โ โ โโโ iot.py # IoT sensor data ingestion
โ โ โโโ colony.py # Colony management
โ โ โโโ collection_points.py # Collection point CRUD
โ โ โโโ leaderboard.py # Rankings & leaderboards
โ โ โโโ camera.py # Camera/image upload
โ โ โโโ transaction.py # User waste transactions
โ โ โโโ health.py # Health check endpoint
โ โ โโโ migration.py # Database migration runner
โ โโโ models/ # 12 data models
โ โ โโโ user.py, collector.py, colony.py, booking.py
โ โ โโโ waste.py, collection_point.py, transaction.py
โ โ โโโ admin.py, analytics.py, achievement.py
โ โ โโโ route_optimizer.py
โ โโโ services/ # Business logic layer
โ โ โโโ ml_service.py # Gemini AI integration
โ โ โโโ analytics_service.py # Analytics calculations
โ โ โโโ notification_service.py # 7 notification types
โ โ โโโ route_optimization.py # TSP + 2-opt route solver
โ โ โโโ realtime_service.py # Live stats & system health
โ โ โโโ points_service.py # Points reward system
โ โโโ utils/ # Validation, geo, file utilities
โ
โโโ frontend/ # React 18 SPA
โ โโโ src/
โ โ โโโ pages/ # 20 page components
โ โ โ โโโ Home, Login, Register, Dashboard
โ โ โ โโโ Camera, Maps, Leaderboard
โ โ โ โโโ IoTMonitor # Live sensor dashboard
โ โ โ โโโ PickupScheduler, AnalyticsDashboard # Collector tools
โ โ โ โโโ CollectorDashboard, CollectorSettings
โ โ โ โโโ AdminLogin, AdminDashboard
โ โ โ โโโ StatsPage, WasteHistoryPage, SettingsPage
โ โ โ โโโ NotFound
โ โ โโโ components/ # 9 component groups
โ โ โ โโโ admin/, auth/, camera/, collector/
โ โ โ โโโ common/ (ProtectedRoute, LoginSelector)
โ โ โ โโโ dashboard/, layout/, leaderboard/, maps/
โ โ โโโ services/ # 11 API service modules
โ โ โโโ hooks/ # Custom hooks (useApi, useCamera, useLocation, useCollectorLocation)
โ โ โโโ context/ # AuthContext (JWT management)
โ โ โโโ store/ # Redux state slices
โ
โโโ iot/ # IoT Hardware
โ โโโ esp32_ultrasonic/
โ โโโ esp32_ultrasonic.ino # ESP32 firmware (HC-SR04 sensor)
โ
โโโ database/ # Database management
โ โโโ schema.sql # Full schema (13+ tables, triggers, views)
โ โโโ iot_migration.sql # IoT sensor_readings table
โ โโโ migrations/ # Versioned migrations
โ โโโ sample_data.sql # Seed data
โ
โโโ deployment/ # Infrastructure
โ โโโ Dockerfile.backend # Backend container
โ โโโ Dockerfile.frontend # Frontend container
โ โโโ docker-compose.yml # Full stack (Nginx, Redis, Prometheus, Grafana)
โ โโโ nginx.conf # Reverse proxy config
โ โโโ deploy.sh / deploy.ps1 # Deploy scripts
โ โโโ cloud-deploy.md # Cloud deployment guide
โ
โโโ docs/ # Detailed guides
โ โโโ RUN_APPLICATION.md
โ โโโ ADVANCED_FEATURES_GUIDE.md
โ โโโ COLLECTION_SYSTEM_GUIDE.md
โ โโโ COLLECTION_COMPLETION_GUIDE.md
โ โโโ PICKUP-SCHEDULER-ALGORITHM.md
โ โโโ FEATURE_ROADMAP.md
โ
โโโ tests/
โ โโโ test_suite.py # API test suite
โ
โโโ SECURITY.md # Security guidelines
- โ๏ธ React 18 with modern hooks & context API
- ๐จ Tailwind CSS with Forms & Typography plugins
- ๐บ๏ธ Leaflet + React-Leaflet for interactive maps
- ๐ Recharts for data visualization
- ๐ JWT authentication with role-based route protection
- ๐งญ React Router v6 with protected routes
- ๐ก Axios for API communication
- ๐ฏ Lucide React & React Icons for iconography
- ๐ Python Flask REST API (v6.0.0)
- ๐ค Google Gemini AI for waste classification
- ๐๏ธ PostgreSQL (Neon) with psycopg2
- ๐ Flask-JWT-Extended for authentication & authorization
- ๐ bcrypt for password hashing
- ๐ก Flask-CORS for cross-origin requests
- ๐ Gunicorn WSGI server for production
- ๐ ESP32 DevKit V1 microcontroller
- ๐ HC-SR04 ultrasonic distance sensor
- ๐ถ WiFi (HTTP/HTTPS) for data transmission
- ๐ API key authentication (
X-IoT-API-Key)
- ๐ Frontend: Vercel (auto-deploy from GitHub)
- ๐ง Backend: Render (Gunicorn, auto-deploy from GitHub)
- ๐๏ธ Database: Neon PostgreSQL (serverless)
- ๐ค AI: Google Gemini API
- ๐ณ Self-hosting: Docker Compose (Nginx + Redis + Prometheus + Grafana)
- Microcontroller: ESP32 DevKit V1
- Sensor: HC-SR04 Ultrasonic Distance Sensor
- Purpose: Real-time bin fill-level monitoring
HC-SR04 VCC โ ESP32 VIN (5V from USB)
HC-SR04 GND โ ESP32 GND
HC-SR04 TRIG โ ESP32 GPIO 5
HC-SR04 ECHO โ [1kฮฉ resistor] โ ESP32 GPIO 18
โ
[2kฮฉ resistor]
โ
GND
Note: The voltage divider on the ECHO pin is required because the HC-SR04 outputs 5V logic, but ESP32 GPIO pins are 3.3V tolerant.
Sensor โ ESP32 โ WiFi โ POST /api/iot/bin-level โ PostgreSQL โ IoT Monitor Dashboard
- Median filtering: Takes 5 samples per measurement, returns median (removes spikes)
- Smart-send: Only transmits when fill level changes by >2% (bandwidth efficient)
- Auto-reconnect: WiFi reconnection with retry logic
- Error reporting: After 5 consecutive sensor errors, sends a status report so the backend knows the device is alive
- HTTPS support: SSL for communication with deployed backend
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/iot/bin-level |
Receive sensor data (auth required) |
GET |
/api/iot/live/<point_name> |
Live fill level for dashboard (public) |
GET |
/api/iot/readings/<colony_id> |
Historical readings for a colony |
GET |
/api/iot/devices |
List all IoT devices with last reading |
| Blueprint | Prefix | Description |
|---|---|---|
auth |
/api/auth |
User/Collector/Admin registration & login |
waste |
/api/waste |
Waste classification & logging |
booking |
/api/booking |
Collection booking system |
collector |
/api/collector |
Collector operations & management |
admin |
/api/admin |
Admin dashboard endpoints |
analytics |
/api/analytics |
Analytics & reporting |
iot |
/api/iot |
IoT sensor data ingestion |
colony |
/api/colony |
Colony management |
collection-points |
/api/collection-points |
Collection point CRUD |
leaderboard |
/api/leaderboard |
Rankings & leaderboards |
camera |
/api/camera |
Camera/image upload |
transaction |
/api/transaction |
Waste deposit transactions |
health |
/health |
Health check |
migration |
/api/migration |
Database migrations |
The PostgreSQL database includes the following key tables:
| Table | Purpose |
|---|---|
users |
User accounts with points & colony assignment |
colonies |
Colony/community data with waste level tracking |
waste_logs |
Waste classification records with AI predictions |
collectors |
Collector profiles & assigned colonies |
collection_bookings |
Scheduled/completed waste pickups |
user_transactions |
Waste deposit records with verification codes |
notifications |
User notifications (7 types) |
points_config |
Configurable points per waste material |
collection_points |
Physical bin locations with capacity tracking |
sensor_readings |
IoT time-series data (fill %, weight, distance) |
Additional features: database triggers for automatic colony point/user count updates, leaderboard views, and performance indexes.
| Page | Route | Role | Description |
|---|---|---|---|
| Home | / |
Public | Landing page |
| Login / Register | /login, /register |
Public | User authentication |
| Dashboard | /dashboard |
User | Personal overview |
| Stats | /dashboard/stats |
User | Waste statistics |
| Waste History | /dashboard/history |
User | Past classifications |
| Settings | /dashboard/settings |
User | Account settings |
| Camera | /camera |
User | AI waste classification |
| Maps | /maps |
Public | Interactive colony/collection point map |
| Leaderboard | /leaderboard |
Public | Colony & user rankings |
| IoT Monitor | /iot-monitor |
Public | Live bin fill-level dashboard |
| Collector Dashboard | /collector/dashboard |
Collector | Pickup management |
| Pickup Scheduler | /collector/scheduler |
Collector | Optimized route scheduling |
| Collector Analytics | /collector/analytics |
Collector | Performance analytics |
| Collector Settings | /collector/settings |
Collector | Profile management |
| Admin Dashboard | /admin/dashboard |
Admin | System management & oversight |
- ๐ฑ Fully optimized for mobile, tablet, and desktop devices
- ๐ Touch-friendly interfaces with intuitive navigation
- ๐ท Native camera integration for waste classification
- ๐ Clean, modern UI built with Tailwind CSS
- โฟ Semantic HTML for screen reader compatibility
- โจ๏ธ Keyboard navigation support
- ๐ฏ High contrast UI elements for visibility
- ๐ Responsive text sizing
- ๐ JWT-based authentication with 24-hour token expiry
- ๐ฎ Role-based route protection (
user,collector,admin) - ๐ bcrypt password hashing
- ๐ซ Debug routes gated behind
FLASK_DEBUG(disabled in production) - โ Production config validation โ raises error if critical env vars are missing
- โ CORS configuration for authorized origins
- ๐ HTTPS encryption for all data transmission
- ๐ IoT API key authentication (X-IoT-API-Key header)
- ๐ Comprehensive error handling without exposing system details
- ๐ Environment variables for all sensitive credentials (never hardcoded)
- ๐ซ No storage of sensitive payment or personal identification data
- ๐ User data collection limited to essential information only
- See SECURITY.md for detailed security guidelines
- ๐ง Powered by Google Gemini AI for accurate waste type detection
- ๐ธ Users upload a photo โ Gemini analyzes the image โ returns waste category, confidence score, and disposal recommendations
- ๐ Supports multiple waste categories: Plastic, Paper, Glass, Metal, Organic, E-waste, Textile
- ๐ฏ Real-time image analysis with confidence scoring
- ๐ Requires internet connectivity for AI classification
- ๐ธ Image quality affects classification accuracy
- ๐ Accuracy depends on lighting and image clarity
- ๐ก Best results with clear, well-lit photos of single items
- โก Serverless frontend deployment on Vercel (auto-scaling)
- ๐ง Backend hosted on Render with Gunicorn (multi-worker)
- ๐๏ธ Neon PostgreSQL (serverless, auto-scaling)
- ๐ก RESTful API design with Blueprint-based modular routes
- โฑ๏ธ Average API response time: < 500ms
- ๐ Frontend optimized with code splitting and lazy loading
- ๐พ Database connection pooling for concurrent users
- ๐ฆ Image compression for faster uploads
- ๐งฎ Route optimization uses Haversine distance + 2-opt solver
- ๐ Backend cold starts on Render free tier (~30s initial load)
- ๐ Map performance may vary with large datasets (>1000 points)
- ๐ Real-time updates use polling (not WebSockets yet)
- ๐ Implement caching layer (Redis) for frequently accessed data
- ๐ก WebSocket integration for real-time updates
- ๐ CDN integration for global content delivery
- ๐ Database sharding for horizontal scaling
- Frontend โ Vercel (auto-deploy from
mainbranch) - Backend โ Render (Gunicorn, auto-deploy from
mainbranch) - Database โ Neon PostgreSQL (serverless)
A full Docker Compose stack is available in deployment/ with:
- ๐ Nginx โ reverse proxy & SSL termination
- ๐ Flask backend โ 2 replicas with resource limits
- โ๏ธ React frontend โ static build served by Nginx
- ๐๏ธ PostgreSQL 15 โ persistent data volume
- ๐ด Redis 7 โ caching & sessions
- ๐ Prometheus โ metrics collection
- ๐ Grafana โ monitoring dashboards
See deployment/cloud-deploy.md for detailed instructions.
SmartWaste360 helps communities:
- โป๏ธ Improve waste sorting accuracy with AI-powered classification
- ๐ Optimize collection routes, reducing fuel consumption
- ๐ Track recycling progress with detailed analytics
- ๐ฑ Reduce environmental footprint through data-driven decisions
- ๐ฅ Engage communities in sustainable waste management
- ๐ก Monitor bin fill levels in real-time with IoT sensors
Detailed guides are available in the docs/ directory:
| Guide | Description |
|---|---|
| RUN_APPLICATION.md | How to run the application |
| ADVANCED_FEATURES_GUIDE.md | Advanced features walkthrough |
| COLLECTION_SYSTEM_GUIDE.md | Waste collection workflow |
| COLLECTION_COMPLETION_GUIDE.md | Collection completion process |
| PICKUP-SCHEDULER-ALGORITHM.md | Route optimization algorithm details |
| FEATURE_ROADMAP.md | Planned features & future work |
| SECURITY.md | Security guidelines & best practices |
- ๐ฑ Modern web browser (Chrome, Firefox, Safari, Edge)
- ๐ท Device with camera for waste classification
- ๐ Internet connection (3G or better recommended)
- ๐ Location services enabled for map features
- ๐ ESP32 DevKit V1
- ๐ HC-SR04 Ultrasonic Sensor
- ๐ง 1kฮฉ + 2kฮฉ resistors (voltage divider)
- ๐ถ WiFi network with internet access
- โก 5V USB power supply
- ๐ Requires stable internet connection for full functionality
- ๐ธ AI classification accuracy varies with image quality (70-90% accuracy)
- ๐บ๏ธ Map features require location permissions
- โฑ๏ธ First load may be slow due to free-tier hosting cold starts
- ๐ก IoT sensor accuracy affected by temperature and humidity
- ๐ Offline mode for basic features
- ๐ฑ Native mobile apps for better performance
- ๐ Multi-language support
- ๐ Push notifications for collection reminders
- ๐ Advanced analytics with predictive insights
- ๐ก WebSocket integration for real-time IoT updates
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with passion for environmental sustainability and smart city solutions
- AI classification powered by Google Gemini API
- Maps provided by OpenStreetMap and Leaflet
- Deployed on Vercel, Render, and Neon platforms
- IoT integration with ESP32 and HC-SR04
- ๐ Report issues on GitHub Issues
- ๐ก Feature requests welcome
- ๐ง Contact for enterprise deployments
- โญ Star this repo if you find it useful!
๐ Ready to make waste management smarter? Start using SmartWaste360 now!