Inspiration We shop every day without thinking about the footprint in our hands. A plastic water bottle takes 450 years to decompose. A bag of chips is wrapped in non-recyclable multilayer plastic that most recycling plants reject. We wanted to make that invisible impact visible — instantly, at the point of purchase, just by pointing a camera at a barcode.
What it does Scan2Sustain lets you scan any food product barcode using your webcam and immediately see its environmental and nutritional profile. In seconds you get the product's Nutri-Score, Eco-Score, NOVA processing group, full nutritional breakdown, and a curated list of healthier or more sustainable alternatives — no account, no subscription, no waiting.
Point your camera at a plastic water bottle and it suggests switching to a reusable stainless steel bottle. Scan a bag of chips and it recommends fresh fruit, nuts, or air-popped popcorn with specific reasons why. The Photo Scan tab lets you upload or take a photo of any product for a full AI-powered environmental impact analysis including carbon footprint, material breakdown, and recyclability ratings.
How I built it Python + OpenCV + zxingcpp for real-time barcode detection via webcam, with a targeting overlay and instant scan feedback Open Food Facts API (both world and Indian endpoints) for free, open product data — no API key required Local HTTP server (Python's http.server) running on port 8765 so the web UI can securely read scan results via scan_data.json without CORS issues Gemini 2.0 Flash for the Photo Scan tab — upload or take a photo of any product and get a full environmental analysis Hardcoded alternative logic with keyword-based category detection so the app always gives meaningful suggestions even without an AI key Vanilla HTML/CSS/JS frontend — no framework, no build step, opens straight in the browser Challenges I ran into Getting the Python scanner and the browser to talk reliably was trickier than expected. A browser can't read local files directly due to CORS restrictions, so we had to embed a proper HTTP server in the Python process. We also hit a race condition where the browser could load a stale scan_data.json from a previous scan — fixed by validating the barcode field in the JSON matches the URL parameter before using the data.
Indian product barcodes were largely missing from the main Open Food Facts database, requiring us to query both the world and India-specific endpoints. We also discovered that running the product lookup on the camera thread froze the entire webcam window for up to 16 seconds — solved by offloading it to a background thread so the camera stays live.
Accomplishments that I'm proud of Getting the full pipeline — camera → barcode detection → product lookup → browser results — working in under two seconds from scan to display. The app works entirely offline for alternatives (no API dependency), and the dual-endpoint Open Food Facts fallback means it handles Indian products that most similar tools miss entirely. The whole stack runs with a single python scan2sustain.py command and zero configuration.
What I learned Real-world barcodes are far messier than test barcodes — lighting, angle, and packaging glare all matter. We learned that zxing-cpp (installed as zxing-cpp but imported as zxingcpp) is significantly more reliable than the alternatives for production scanning. We also learned that environmental data like Eco-Score is still missing for a huge portion of products, which highlighted exactly why apps like this matter — the data gap is itself a problem worth solving.
What's next for Scan2Sustain Scan history and impact tracker — total plastic avoided, carbon saved, cumulative score over time Retailer integration — show where to actually buy the suggested alternatives nearby Expanded product database — crowdsource missing Eco-Scores for products not yet in Open Food Facts Mobile app — bring the same camera scanning to Android/iOS so it works at the shelf, not just at home
Log in or sign up for Devpost to join the conversation.