DEV Community

S M Tahosin
S M Tahosin

Posted on • Edited on

EcoSense AI: Know Your Carbon Footprint in 60 Seconds

DEV Weekend Challenge: Earth Day

This is a submission for Weekend Challenge: Earth Day Edition

What I Built

EcoSense AI is an AI-powered carbon footprint analyzer that helps people understand their environmental impact through a simple 4-step questionnaire — with persistent memory and carbon offset donations.

Users answer questions about their:

  • 🚗 Transportation — commute method & distance
  • 🍽️ Diet — from heavy meat to vegan
  • Home Energy — fossil fuels to 100% renewable
  • 🛍️ Shopping — fast fashion to minimal/second-hand

Then the app:

  1. Google Gemini 2.0 Flash analyzes their habits and returns an eco score, CO2 estimate, personalized tips, and Earth Day pledge
  2. Backboard saves each assessment to persistent memory threads, enabling progress tracking over time
  3. Solana enables carbon offset tree-planting donations via SOL transfers

Demo

🌍 Live: https://ecosense-ai.pages.dev

Try it now — takes about 60 seconds!

Features:

  • Eco Score (0-100) with SVG donut chart visualization
  • Letter grade (A+ to F) with estimated annual CO₂
  • Impact breakdown by category with color-coded status bars
  • 5 personalized tips from Gemini AI
  • Earth Day pledge with copy-to-clipboard sharing
  • Carbon offset via Solana donation
  • Memory persistence via Backboard threads

Code

GitHub logo x-tahosin / ecosense-ai

AI Carbon Footprint Analyzer - Google Gemini + Backboard + Solana | Earth Day 2026

🌍 EcoSense AI

AI-Powered Carbon Footprint Analyzer | Earth Day 2026

Live Demo Dev.to

Next.js Gemini Backboard Solana Cloudflare Tailwind


What It Does

Answer 4 quick questions about your daily habits and Google Gemini analyzes your carbon footprint in real-time:

  • Eco Score (0-100) with letter grade and SVG donut chart
  • Estimated annual CO2 compared to global average
  • Impact breakdown by category (transport, diet, energy, shopping)
  • 5 personalized tips to reduce your footprint
  • Earth Day pledge — copy and share on social media
  • Carbon offset — donate SOL via Solana to plant trees
  • Progress tracking — Backboard memory saves your assessments

Architecture

Browser → Static HTML/JS (Cloudflare Pages)
            ↓
         /api/generate → Cloudflare Function → Google Gemini API
         /api/memory   → Cloudflare Function → Backboard API
         
         API keys NEVER reach the browser.

Tech Stack

Technology Purpose
Next.js 16 Static export frontend
Google Gemini 2.0 Flash AI analysis engine
Backboard Persistent memory threads
Solana Carbon offset donations
Cloudflare Pages Hosting + serverless functions

Key files:

  • app/page.tsx — Full React UI with step wizard, score visualization, Solana integration, and Backboard memory status
  • functions/api/generate.js — Cloudflare Function proxying Gemini (API key never reaches browser)
  • functions/api/memory.js — Cloudflare Function proxying Backboard memory API

How I Built It

Tech Stack

  • Next.js 16 with static export
  • Tailwind CSS — custom green/earth color palette
  • Google Gemini 2.0 Flash — AI analysis engine
  • Backboard — persistent memory for tracking assessments over time
  • Solana — carbon offset tree-planting donations
  • Cloudflare Pages — hosting + serverless functions
  • Lucide React — iconography
  • GitHub Copilot — used throughout development for rapid iteration

Architecture: Everything Server-Side

Browser → Static HTML/JS (Cloudflare Pages)
            ↓
         /api/generate → Cloudflare Function → Google Gemini (key server-only)
         /api/memory   → Cloudflare Function → Backboard API (key server-only)
Enter fullscreen mode Exit fullscreen mode

No API keys ever touch the browser. Both Gemini and Backboard calls go through Cloudflare Functions.

How Each Technology Is Used

Google Gemini — The core analysis engine. I send a structured prompt with the user's 4 selections and ask for specific JSON output: score, grade, CO₂ estimate, impact breakdown, tips, and pledge. Temperature 0.7 gives the best variety/accuracy balance.

Backboard — After each analysis, results are saved to a Backboard memory thread keyed by session ID. This enables returning users to see progress over time — "Your score improved from 45 to 62 since last month!" The memory API gracefully falls back if unavailable.

Solana — The results page calculates how many trees would offset the user's footprint (~1 tree absorbs ~22kg CO₂/year) and offers a Solana donation option. SOL is ideal for micro-donations: sub-second finality, fraction-of-a-cent fees, and Solana's Proof of Stake uses 99.9% less energy than Proof of Work chains.

GitHub Copilot — Used throughout development for the step wizard logic, SVG chart math, and Tailwind styling. Copilot's inline suggestions accelerated the build significantly.

UI Highlights

  • Step wizard with animated progress bar
  • SVG donut chart for the eco score
  • Color-coded impact badges (red → green)
  • Category breakdown bars in the results
  • Purple Solana donation panel with explorer link
  • Blue Backboard memory status indicator
  • Copy-to-clipboard Earth Day pledge for social sharing

Prize Categories

  • Best Use of Google Gemini — Gemini is the core engine producing calibrated environmental analysis from 4 simple inputs
  • Best Use of Solana — Carbon offset donations via SOL, leveraging Solana's eco-friendly PoS consensus
  • Best Use of GitHub Copilot — Copilot accelerated the entire build from UI components to API integration
  • Best Use of Backboard — Persistent memory threads track assessment history for progress monitoring

Top comments (3)

Collapse
 
jon_at_backboardio profile image
Jonathan Murray

Let's goooo! How was your experience with backboard? would you recommend?

Collapse
 
tahosin profile image
S M Tahosin

Thanks Jonathan! Backboard was great to integrate — I used it for the memory/pledge system in EcoSense AI so users' carbon footprint commitments persist across sessions. The API is straightforward and the free tier covers everything I needed. Definitely recommend it if you need a simple key-value store or memory layer for AI apps. What are you building with it?

Collapse
 
jon_at_backboardio profile image
Jonathan Murray

I'm building Backboard 😉