Inspiration
Consumers make over 500 billion grocery purchasing decisions every year with virtually zero environmental context. I kept picking up products in supermarkets wondering — is this actually a sustainable choice? There was no fast, free answer. Certification labels are scattered, eco databases are behind paywalls, and nothing works at the speed of a checkout line. GreenLens is the tool I wished existed.
What it does
Scan or type any product barcode. GreenLens:
- Looks up the product in the Open Food Facts database (3M+ products worldwide)
- Sends the data through a two-stage AI pipeline — a scorer agent, then a self-validator — analyzing ingredients, processing level, packaging, and supply chain signals
- Returns an A–F environmental grade, three sub-scores (CO₂ footprint, water usage, packaging), the specific reasons behind the rating, and greener product categories to look for
No signup. No install. Works in any modern browser on any device in under 5 seconds.
How we built it
- Frontend: React 19 + Vite + Tailwind CSS, deployed on Vercel. Animated grade cards, staggered score bars, scan history via localStorage.
- AI pipeline: Two-stage Groq (Llama 3.3 70B). Stage 1 scores the product. Stage 2 self-validates — enforcing that ultra-processed (NOVA 4) products can't score well on CO₂, beef/lamb products have low water scores, and grades align with Open Food Facts' certified ecoscore when available. Falls back to Stage 1 if validation fails.
- Security: Groq API key is server-side only, proxied through a Vercel serverless function — never exposed to the client.
- Performance: 7-day barcode cache in localStorage so re-scanning the same product is instant. Native BarcodeDetector Web API for camera scanning — no library dependency.
Challenges we ran into
The hardest problem was scoring reliability. A single LLM pass produced inconsistent results — an ultra-processed product sometimes received an undeservedly high CO₂ score. We solved this with a validator agent: a second LLM call with an explicit consistency ruleset that catches and corrects errors before they reach the user.
Data completeness was the other challenge. Many Open Food Facts entries are missing packaging data or NOVA group classification. We designed the prompt to reason gracefully from partial data, and used the certified ecoscore as an anchor when available.
Accomplishments that we're proud of
- A self-validating two-stage AI pipeline that produces more consistent scores than a single LLM pass
- Full barcode scanning via the native BarcodeDetector Web API — no library, no install
- Animated result cards that make the eco grade feel visceral and immediate
- Working unit test coverage across hooks, components, and API utilities
- Zero-friction access — no account, no download, one scan
What we learned
LLM outputs are a starting point, not a finished product. The validator agent pattern — treating the first pass as a draft and the second as a quality gate — is something we'll apply to every AI-native app we build going forward.
We also learned that simplicity is the feature. The most impactful design decision was making the app zero-friction. Environmental data exists. What's been missing is delivery at checkout-line speed.
What's next for GreenLens
- PWA + offline support — installable, with cached results for the most scanned products
- Household footprint tracker — aggregate environmental impact across all your scans
- Category expansion — cosmetics and household products via Open Beauty Facts
- Retailer API — license the scoring engine to grocery apps and loyalty platforms
Built With
- barcodedetector-web-api
- groq
- llama-3.3-70b
- open-food-facts
- react-19
- tailwind-css
- vercel
- vite
Log in or sign up for Devpost to join the conversation.