Skip to content

Cypher-redeye/GreenLens

Β 
Β 

Repository files navigation

🌿 GreenLens - Enterprise B2B Sustainability Platform

React FastAPI PostgreSQL Gemini AI PWA License

Smart & Digital Innovation | Sustainability Hackathon 2026

Track your carbon. Transform your organization.

GreenLens is a production-grade, multi-tenant B2B SaaS platform that empowers modern enterprises, campuses, and organizations to track, manage, and reduce their collective carbon footprint using AI.

🌐 Live Production Application


πŸš€ Key Enterprise Features

🏒 B2B Multi-Tenancy Architecture

  • True multi-tenant data isolation using a core Organization structure.
  • Role-Based Access Control (RBAC): Users are assigned either admin or employee roles.
  • Corporate Admin Dashboard: A dedicated, protected route for administrators to view aggregated company-wide COβ‚‚ savings.

πŸ›‘οΈ Enterprise-Grade Security & Fraud Prevention

  • pHash (Perceptual Hashing) Fraud Detection: Implemented ImageHash with a 30-day sliding window to prevent users from uploading visually similar receipts to cheat the leaderboard.
  • DDoS & Cost Protection: Strict API rate-limiting via slowapi on expensive LLM routes (5 req/min) to prevent abuse of the Gemini Vision API.
  • OOM Protection: Hard limits on UploadFile sizes (Max 5MB) to prevent memory exhaustion attacks.
  • Secure Auth: JWT-based authentication with bcrypt password hashing and enforced strong password policies.

πŸ“± Progressive Web App (PWA)

  • Full PWA support allowing employees to install GreenLens directly to their iOS or Android home screen for a seamless, native-app-like receipt scanning experience.

πŸ“Š Compliance & Reporting

  • 1-Click CSV Export: Administrators can instantly download a formatted CSV report of their entire organization's carbon offset activities for sustainability compliance and CSR reporting.
  • Dynamic Data Visualization: High-performance charting using Recharts to visualize offset trends over time.

πŸ€– Gemini AI Integration

  • Vision Scanning: Uses Google Gemini 1.5 Flash to automatically extract carbon footprint data from photos of food or transport receipts.
  • AI Coach: Generates contextual, personalized nudges encouraging employees to make greener choices.

πŸ› οΈ Tech Stack

Backend

Technology Purpose
FastAPI High-performance async web framework
SQLAlchemy ORM for database interactions
PostgreSQL Relational Database (Neon)
SlowAPI Endpoint rate limiting
ImageHash Perceptual hashing for fraud detection
Alembic Database migrations

Frontend

Technology Purpose
React + Vite Lightning-fast UI framework
Tailwind CSS Utility-first styling
Recharts Corporate dashboard data visualization
Vite PWA Progressive Web App integration
Axios Secure API communication

πŸ“‚ Project Structure

GreenLens/
β”œβ”€β”€ backend/                      
β”‚   β”œβ”€β”€ main.py                  # Core API, Auth, Rate Limiting & Admin Routes
β”‚   β”œβ”€β”€ models.py                # Organizations, Users, Activities, Stats
β”‚   β”œβ”€β”€ vision.py                # pHash Fraud Detection + Gemini API
β”‚   β”œβ”€β”€ alembic/                 # DB Migrations for Multi-Tenancy
β”‚   └── requirements.txt          
β”‚
β”œβ”€β”€ frontend/                     
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminDashboardPage.jsx # Protected corporate analytics
β”‚   β”‚   β”‚   β”œβ”€β”€ DashboardPage.jsx      # Employee personal view
β”‚   β”‚   β”‚   └── AuthPages.jsx          # Org creation & signup flow
β”‚   β”‚   └── api.js               # Centralized Axios interceptors
β”‚   β”œβ”€β”€ vite.config.js           # PWA configuration
β”‚   └── package.json             

⚑ Local Setup

1. Clone the repository

git clone <your-repo-url>
cd GreenLens

2. Backend Setup

cd backend
pip install -r requirements.txt
# Add .env with DATABASE_URL, SECRET_KEY, GEMINI_API_KEY
alembic upgrade head # Run migrations
python main.py

3. Frontend Setup

cd frontend
npm install
# Add .env.local with VITE_API_URL=http://localhost:8000
npm run dev

🀝 Team

GreenLens Development Team

  • Smart & Digital Innovation Category
  • Building scalable SaaS for a sustainable future.

Built for the Parul University Sustainability Hackathon 2026

About

🌿 Track your carbon footprint, compete with peers, and drive sustainability across your campus. Powered by React, FastAPI, Neon PostgreSQL, and Gemini AI. ⚑

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 50.5%
  • Python 43.3%
  • CSS 5.1%
  • Other 1.1%