Stop guessing your carbon footprint. Start optimizing it.
π Deployed for OSF HackOne 2K26 β Final Round | Category: Sustainability & CleanTech
π§ Team Last Brain Cell
Task: Implement a Real-Time Carbon Compliance & Intelligent Alert System
Implementation Highlights:
- Compliance Engine: Dynamically calculates a 100-point Sustainability Score weighted by reduction progress, supplier ESG ratings, emission trends, and strict threshold adherence.
- Intelligent Alerts: Real-time evaluation background tasks that trigger on emission spikes (e.g., >15% month-over-month) or threshold breaches.
- Actionable Recommendations: Rule-based generation of mitigation strategies (e.g., switching transport modes, renegotiating with high-intensity suppliers) tied to real data.
- PDF Compliance Reporting: Generates automated, multi-page compliance reports featuring scope summaries and current-vs-previous month trend charts.
- Full-Stack Integration: Integrated into the main dashboard, featuring a dedicated
Compliance Monitorinterface with Recharts gauges, severity badges, and interactive alert management.
Scope 3 emissions account for 70-90% of a company's total carbon footprint β yet they remain the hardest to track, buried across fragmented supplier data, complex logistics networks, and inconsistent reporting standards. Today's sustainability teams rely on:
- β Manual spreadsheets that are error-prone, static, and hard to audit.
- β Expensive enterprise tools ($50K+/year) that are completely inaccessible to SMEs.
- β Disconnected supply chains with zero visibility into supplier-specific ESG performance.
- β No actionability β teams can calculate baseline numbers but cannot mathematically optimize logistics routes.
CarbonLens is an open-source, full-stack, AI-powered carbon intelligence platform that democratizes Scope 1, 2, and 3 footprint tracking. It enables organizations to map their entire supply chain, forecast future emissions, and use linear programming to optimize shipping logistics and supplier sourcing for minimum carbon impact β completely free.
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React 18 Β· TypeScript Β· Tailwind CSS Β· shadcn/ui | Type-safe, accessible UI with 15+ Radix UI primitives |
| State | Zustand Β· TanStack React Query | Lightweight global state + server state caching and syncing |
| Visualization | Recharts Β· React Flow Β· Dagre | Interactive dashboard charts and automatic supply chain graph layouts |
| Backend | FastAPI Β· Python 3.11 Β· Poetry Β· Pydantic v2 | High-performance, async API with comprehensive validation |
| Database | Supabase (PostgreSQL) Β· Async SQLAlchemy | Relational storage with connection pooling (10+20) & RLS |
| AI/ML | Groq (LLaMA 3.3 70B) Β· Anthropic (Claude 3 Haiku) | Dual-LLM resilient pipeline with automatic mock fallback |
| Optimization | Google OR-Tools (GLOP LP Solver) | Linear programming for supplier allocation & transport minimization |
| Reports | ReportLab Β· Matplotlib | PDF report compilation engine with dynamic data charts |
| Monitoring | Sentry Β· structlog Β· SlowAPI | Real-time error capture, structured logging, and endpoint rate limits |
| CI/CD | GitHub Actions | Parallel jobs for backend (Ruff/Mypy/Pytest) & frontend (ESLint/Tsc) |
- Node.js β₯ 18
- Python β₯ 3.11 & Poetry
- Git
- A free Supabase account & a free Groq API Key
git clone https://github.com/stack-rishi/CarbonLens.git
cd CarbonLens
cp .env.example .env
# Open .env and fill in your database details, Supabase keys, and Groq API keys.cd backend
poetry install
poetry run alembic upgrade head
poetry run python seed.py # Seeds the database with sample suppliers and 24 months of emissionscd ../frontend
npm installRun both backend and frontend servers simultaneously using the development launcher script in the root directory:
python scripts/dev.py- π Frontend URL:
http://localhost:5173 - π‘ API Docs:
http://localhost:8000/docs - π€ Demo Credentials:
admin@acmecorp.com/password123
Mandatory disclosure as per OSF HackOne 2K26 Rules (Section 3)
| AI Tool | Usage Area | How It Was Used |
|---|---|---|
| Claude (Anthropic) | Code Assistance | Used for code generation, debugging, architecture decisions, and README documentation. All AI-generated code was reviewed, understood, and modified by team members before integration. |
| Gemini (Google) | Code Assistance | Used as an AI coding assistant for development support, code suggestions, and project scaffolding. |
β οΈ Disclaimer: All AI-assisted code was thoroughly reviewed, tested, and validated by team members. The core logic, architecture design, and problem-solving approach are original work by Team Last Brain Cell. AI tools were used as productivity aids, not as a substitute for understanding.
| Member | Role | Responsibilities |
|---|---|---|
| Rishi Sharma | Full Stack Developer | Backend architecture, database schema, AI/ML integration, optimizer service, DevOps |
| Anshika Roy | Full Stack Developer | Frontend UI/UX, component development, React Flow integrations, data visualizations |
π Watch the Live Product Demo Video (Google Drive)
- π» Web Application: https://carbonlens-app.vercel.app
- βοΈ Backend API Endpoint: https://carbonlens-backend.onrender.com
- π₯ Backend Swagger Docs: https://carbonlens-backend.onrender.com/docs
Provides an aggregated bird's-eye view of your entire carbon footprint over a rolling 12-month period.

Visualizes monthly emission patterns across Scopes and monitors compliance towards target Net Zero goals.

Graph representation of upstream and downstream suppliers using React Flow, heatmapped by carbon intensity with auto-layout positioning.

Comprehensive tabular view of raw emission records with advanced date-range filters, scope grouping, and CSV export capabilities.

Trained sustainability AI assistant grounded in your database and aligned with international environmental frameworks.

βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND (Vercel) β
β React 18 β’ TypeScript β’ Tailwind CSS β’ shadcn/ui β’ Zustand β
β ββββββββββββ βββββββββββββ ββββββββββββ ββββββββββββββββββββββββ β
β βDashboard β βEmissions β βSuppliers β β Supply Chain Graph β β
β β Page β β Ledger β β Manager β β (React Flow+Dagre) β β
β ββββββββββββ βββββββββββββ ββββββββββββ ββββββββββββββββββββββββ β
β ββββββββββββ βββββββββββββ ββββββββββββ β
β βAI Chat β β Reports β βOnboardingβ β
β β Co-Pilot β β Page β β Wizard β β
β ββββββββββββ βββββββββββββ ββββββββββββ β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββ€
β Axios + Bearer β TanStack React Query (cache/invalidation)β
β Token Auth β Sentry Error Tracking β
ββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββ€
β BACKEND API (Render) β
β FastAPI β’ Python 3.11 β’ Poetry β’ Async SQLAlchemy β’ Alembic β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Middleware Stack β β
β β Request Logging (structlog) β Security Headers β UUID IDs β β
β β Rate Limiting (SlowAPI) β CORS β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββ βββββββββββββ ββββββββββββ ββββββββββββββββββββββββ β
β βAuth API β βEmission β βSupplier β βSupply Chain API β β
β β/register β β API β β API β β /graph /edges β β
β β/login β β/records β β/CRUD β β /forecast /optimize β β
β β/me β β/summary β β/bulk β β β β
β ββββββββββββ β/trend β β/optimize β ββββββββββββββββββββββββ β
β βββββββββββββ ββββββββββββ β
β ββββββββββββ βββββββββββββ ββββββββββββββββββββββββββββββββββββ β
β βReport β βAI Service β β Optimizer Service β β
β βGenerator β βGroqβClaudeβ β Google OR-Tools GLOP LP Solver β β
β β(ReportLabβ ββMockChain β β Multi-modal Route Comparison β β
β β+Matplotlibβ βββββββββββββ ββββββββββββββββββββββββββββββββββββ β
β ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DATABASE (Supabase) β
β PostgreSQL + asyncpg β’ Connection Pool (10+20) β’ RLS β
β 7 Tables: Organization, User, Supplier, EmissionRecord, β
β SupplyChainEdge, Report, AIConversation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Supply Chain Graph Intelligence: Integrates Dagre auto-layout nodes with dynamic trend arrows mapping emission intensity changes over rolling periods.
- OR-Tools LP Sourcing Optimization: Solves multi-variable sourcing problems using Google's Linear Programming solver to minimize carbon footprint while satisfying production demands.
- Resilient AI Failover Chain: Routes prompts dynamically through Groq (LLaMA 3.3) with instant fallback to Anthropic (Claude 3 Haiku) and structured mocks.
- Verified GHG Calculations: Automated transport emissions (weight Γ distance Γ vehicle factor), energy emissions (kWh Γ national grid factor), and materials calculations.
erDiagram
Organization ||--o{ User : has
Organization ||--o{ Supplier : manages
Organization ||--o{ EmissionRecord : tracks
Organization ||--o{ SupplyChainEdge : connects
Organization ||--o{ Report : generates
Organization ||--o{ AIConversation : initiates
Supplier ||--o{ EmissionRecord : produces
Supplier ||--o{ SupplyChainEdge : "from/to"
User ||--o{ Report : creates
User ||--o{ AIConversation : chats
Organization {
uuid id PK
string name
string sector
string country
enum plan "free/pro/enterprise"
}
User {
uuid id PK
uuid org_id FK
string email UK
string password_hash
enum role "admin/analyst/viewer"
}
Supplier {
uuid id PK
uuid org_id FK
string name
string country
float emission_factor
float esg_score
float lat
float lng
}
EmissionRecord {
uuid id PK
uuid org_id FK
uuid supplier_id FK
int scope
string category
float amount_tco2e
date period_start
date period_end
}
SupplyChainEdge {
uuid id PK
uuid org_id FK
uuid from_supplier FK
uuid to_supplier FK
enum transport_mode
float distance_km
float weight_tonnes
}
| Evaluation Criteria | Mark Distribution | CarbonLens Implementation |
|---|---|---|
| Innovation & Originality | /25 | Combining linear programming optimization, interactive flow layout charts, and resilient multi-provider AI grounding. |
| Technical Implementation | /20 | Async FastAPI, SQLAlchemy integration, connection pooling, production-grade Docker, CI/CD pipelines, security headers, SlowAPI. |
| Problem-Solving Relevance | /15 | Offers a zero-cost Scope 3 mapping utility to allow mid-market enterprises and SMEs to calculate footprints without enterprise costs. |
| Completeness of the Build | /15 | 8 functional pages, CSV bulk import engines, PDF report compiling, interactive supply chain maps, optimization tools. |
| UI/UX & Functionality | /10 | Beautiful CSS customization, tailored dark theme styling, Radix primitive components, toast notifications, animated wizard interfaces. |
| Presentation & Q&A | /10 | Deployed live web application, complete API docs, and comprehensive README documentation. |
| Scalability & Impact | /5 | Stateless design suited for horizontal scaling, lightweight global stores, edge network deployment. |
For containerized backend deployments:
# Build multi-stage optimized image
docker build -f docker/Dockerfile.backend -t carbonlens-api .
# Run
docker run -p 8080:8080 --env-file .env carbonlens-apiBuilt with π for a sustainable future by Team Last Brain Cell