🧠 Inspiration

Food waste is a global issue. Every year, millions of tons of edible food are thrown away, often because we simply forget what we bought or don't know how to use it in time. We wanted to create a smart, intuitive tool that not only tracks ingredients but also helps people cook creatively with what they already have.

πŸ’‘ What it does

Before It Spoils is a web application that helps users reduce food waste by:

  • πŸ“Έ Using OCR (Optical Character Recognition) to scan shopping receipts.
  • 🧠 Extracting grocery items using AI (Gemini) with natural language understanding.
  • πŸ₯« Tracking pantry ingredients along with their estimated expiration dates.
  • 🍽️ Suggesting recipes based on what's in your pantry.
  • πŸ” Managing users securely using JWT-based authentication.

The result is a smarter kitchen assistant that helps people make the most of what they already have at home.

πŸ› οΈ How we built it

  • Frontend: Built in React.js with clean UI for entering ingredients or uploading receipts.
  • Backend: Developed using Flask, organized using Blueprints for modularity.
  • OCR: Integrated pytesseract to extract text from uploaded receipt images.
  • AI/NLP: Used Google's Gemini API to process raw receipt text and generate structured grocery data and recipes.
  • Database: Used MongoDB Atlas to store user data, pantry items, and expiration info.
  • Authentication: Implemented JWT to manage secure, authenticated access to user-specific pantry data.
  • Deployment: Planned for Docker-based deployment and containerization to support OCR dependencies (e.g., Tesseract).

πŸ§— Challenges we ran into

  • Getting OCR to consistently read receipt text accuratelyβ€”especially from low-quality images.
  • Structuring AI prompts in a way that would return clean, parseable JSON.
  • Managing OCR dependencies like Tesseract in a cloud deployment environment (e.g., Render).
  • Ensuring the backend and frontend worked seamlessly across separate repos.
  • Handling edge cases in natural language parsing of grocery items.

πŸ† Accomplishments that we're proud of

  • Successfully integrated multiple technologies (OCR + NLP + AI) into a coherent user flow.
  • Built a modular backend with clean structure using Flask Blueprints.
  • Created a full JWT-based user system from scratch.
  • Developed a real use-case where AI provides clear utility.
  • Made progress toward a tool that could help real households reduce waste and save money.

πŸ“š What we learned

  • How to use Gemini's language model effectively for structured JSON outputs.
  • Best practices in modular Flask design and API development.
  • Practical challenges in OCR + NLP pipelines and prompt engineering.
  • Hands-on experience with MongoDB in Flask, secure authentication with JWT, and full-stack project structuring.
  • How to troubleshoot containerization with Docker, especially for services like Tesseract.

πŸš€ What's next

  • πŸ“± Mobile support – to allow users to snap receipts on the go.
  • πŸ›’ Grocery APIs – integrate with external APIs (e.g., barcode scanners or supermarket data).
  • 🧠 Smarter expiration predictions – based on purchase date + typical shelf life + user habits.
  • πŸ”” Reminders & notifications – to alert users before items expire.
  • πŸ‘ͺ Multi-user support – shared pantry features for households.
  • 🌍 Public recipes & community pantry ideas – explore what others are cooking with similar items.

Built With

Share this project:

Updates