DEV Community

Ben Wong-Fodor
Ben Wong-Fodor

Posted on

Solving Food Waste

Built with Google Gemini: Writing Challenge

How I solved food waste (winning 1st place overall at Northwestern University's largest ever hackathon in the process).

Of course, only the latter part of that statement is true—food waste is a global titan of a problem—but the experience of building Farm Connect taught me that with the right AI tools, even a small team can build a bridge between a tragedy and a solution.

This began my Freshman year of college when I joined Northwestern's flagship Hackathon on a team that had just met and formed the day of the hackathon. Combined we were a man short than other teams and only had 5 years of programming experience between the three of us. Looking at our very qualified opponents we realized quickly that our best chance would be to tackle and solve an important global issue with our project and focus on technical implementation later. We chose the theme of agriculture (thinking incorrectly that it would be the least competitive) and decided to begin by doing research into major issues that face the agriculture industry.

We built Farm Connect to bridge this gap. Our mission? To turn grocery store "waste" into high-quality animal feed using Google Gemini as our intelligent matchmaker.

The Inspiration
Over 5 million tonnes of food are wasted yearly. Much of this is perfectly edible but gets tossed due to "best-by" dates or cosmetic imperfections. Though we humans are picky, most livestock doesn't care if an apple is bruised—they just need the nutrients.

We realized the hurdle wasn't a lack of food; it was a data problem. Stores don't know what’s safe for which animal, and farmers don't have time to sort through trash.

The Tech Stack
We designed a marketplace to connect restaurants and stores that have leftover produce with organic farmers who want a more nutrient rich substitute for their livestock. We went with a robust, scalable stack to ensure the platform could handle real-time listings:

Frontend: React (for a dynamic, mobile-responsive interface)
Backend: Node.js
Database & Auth: Supabase (PostgreSQL)
Maps: Google Maps API (to calculate the "carbon footprint" and pickup proximity)
AI Engine: Google Gemini

The Brains: Integrating Gemini AI
The core challenge of Farm Connect is safety. You can’t feed onions to dogs or excessive citrus to certain livestock. Instead of writing thousands of lines of if/else statements for every food type, we utilized Gemini to analyze listings in real-time.

Gemini was crucial in all parts of this project. We used it for research on food waste, to write project descriptions, to help us debug errors and provide suggestions on how to improve our application.

How we used it:
Categorization: When a store lists "20 lbs of wilted spinach and 10 lbs of day-old bread," Gemini parses this unstructured text.

Nutritional Mapping: It identifies that the spinach is high in iron and the bread is a carbohydrate source.

Cross-Referencing: Gemini matches these items against a farmer's specific livestock. If a farmer has chickens, Gemini flags the bread as a great supplement but warns if any listed item contains caffeine or excessive salt.

Decision Making: It provides a "Match Score," helping farmers prioritize which pickups are worth the drive based on their animals' current dietary needs.

Technical Win: By using Gemini, we moved from simple keyword searching to biological reasoning.

Challenges We Tackled
Data Quality was our biggest enemy. A "bag of mixed scraps" is a liability, not a resource. We used Gemini to build a validation layer. If a store's description is too vague, the AI prompts the user: "Is there any meat or dairy in this batch? This is vital for swine safety." This ensured that our database stayed clean and our farmers stayed informed.
Accomplishments We're Proud Of
1st Place Overall: The judges loved the marriage of sustainability and high-tech AI.
Seamless UX: A store can list an item in under 30 seconds.
Real-World Impact: We created a direct channel to keep tons of organic matter out of landfills while lowering overhead for local farmers.

What’s Next for Farm Connect?
We’re just getting started. Our roadmap includes:
Multi-Agent Systems: Using the Google Agent Development Kit (ADK) to create specialized "Logistics Agents" that optimize pickup routes.
Mobile App: Taking the React build to React Native for on-the-go listing.
Regulatory Tech: Automating the legal paperwork required for food-to-feed transfers in different states.

Top comments (0)