DEV Community

Hamza Atiq
Hamza Atiq

Posted on

Ecolens

DEV Weekend Challenge: Earth Day

This is a submission for Weekend Challenge: Earth Day Edition

What I Built

EcoLens is an AI-powered eco-companion that lets you scan any everyday object and instantly learn its environmental impact. Upload or photograph anything, a plastic bottle, a piece of clothing, a coffee cup, then Gemini 2.5 Flash Vision returns a structured eco-report with carbon footprint, planet score (0–100), recyclability breakdown, and three greener swap suggestions.
What makes it more than a one-off tool: Backboard persistent memory remembers your entire scan history. On your second scan, a personalised panel appears referencing what you've scanned before. The summary page pulls your Backboard memories to generate a weekly eco-journey narrative with a planet-score trend chart.

Demo

Code

🌍 EcoLens β€” AI Eco-Companion

Scan any object. Discover its environmental impact. Build greener habits over time.

Point your camera at any everyday object β€” a plastic bottle, a piece of clothing, a coffee cup β€” and Gemini 2.5 Flash Vision instantly returns a full eco-report. Backboard's persistent memory means EcoLens remembers your scan history and gives you increasingly personalised sustainability advice over time.


✨ Features

  • Instant eco-report β€” carbon footprint (kg COβ‚‚), planet score (0–100), recyclability breakdown, 3 greener swap suggestions, and a fun environmental fact
  • Persistent memory β€” Backboard remembers every object you've ever scanned; on your second visit the app greets you with personalised advice referencing your history
  • Weekly eco-journey β€” /summary page pulls your Backboard memories to generate an AI narrative of your sustainability progress, complete with a planet-score bar chart and trend badge
  • Mobile-first β€” drag-drop or take a live photo directly from your phone…

How I Built It

Stack: Next.js 14 (App Router) Β· Tailwind CSS Β· Backboard SDK Β· Vercel
Two distinct Gemini 2.5 Flash calls per scan:

  1. Vision analysis β†’ structured JSON eco-report (carbon_kg, planet_score, recyclable/not_recyclable arrays, eco_swaps, fun_fact)
  2. Memory-aware personalised advice β†’ references the user's full scan history via Backboard's Auto memory mode Backboard integration:
  3. One persistent assistant ("EcoLens Assistant") per app, looked up by name on init
  4. One thread per user, keyed by browser UUID in localStorage
  5. memory: "Auto" on every addMessage call, Backboard automatically extracts and stores facts from each eco-report
  6. summary page calls getMemories() to surface raw memories alongside an AI-generated weekly narrative Images are base64-encoded client-side, written to a temp file server-side, and passed to Backboard's addMessage via the files parameter. Backboard routes them to Gemini via BYOK.

Prize Categories

  • Best Use of Google Gemini β€” two Gemini 2.5 Flash calls per scan (vision analysis + memory-aware personalisation), structured JSON output contract, BYOK via Backboard
  • Best Use of Backboard β€” persistent assistant memory across sessions, Auto memory mode, getMemories for weekly summary, thread persistence in localStorage

Hamza Atiq(Me)

Top comments (0)