Inspiration

Living with food allergies or dietary restrictions means constantly second-guessing ingredients, whether at a restaurant, a friend's house, or when grabbing a packaged snack. Reading labels is time-consuming, and cross-contamination warnings are easy to miss when skimming a bag. We wanted a tool that gives people instant, personalized answers: "Can I eat this?" SnackSafe was born from the idea that everyone deserves to eat with confidence, without the stress of decoding ingredient lists or worrying about hidden allergens wherever they eat.

What it does

SnackSafe helps users decide whether a food item is safe for them based on their allergens and dietary restrictions. Users create an account, set their allergies (e.g., nuts, shellfish) and dietary needs (halal, vegan, gluten-free, kosher, celiac, keto, and more), then scan any food by uploading a photo or describing the dish. Our AI analyzes the input against their profile and returns a personalized safety assessment: a numerical score, detected foods, allergen risks, dietary flags, reasoning, and recommendations. Users get clear ratings: "Safe to eat," "Be careful," or "Do not eat." They can also generate a shareable safety card, which is a simple card showing their allergens and dietary needs that they can use to share with restaurant staff or hosts. Over time, the app learns from thumbs-up/thumbs-down reactions to improve future recommendations.

How we built it

Our database management, authentication management, and block storage system is Supabase. The frontend is built using React, TypeScript, TailwindCSS, shadcn-ui, tanstack router, tanstack query, and the Supabase client library. The frontend sends scan requests to the backend for image processing. Images are saved to Supabase and encoded to the WebP format for recognition by the API. The backend is built using Python, FastAPI, and the Gemini API for image/text processing.

Challenges we ran into

Balancing safety with usefulness: We had to design the AI prompt so it would be conservative (e.g., no guessing cross-contamination) without being so cautious that it flagged everything as unsafe. We iterated on system instructions and added explicit logic to filter out speculative allergen risks when there is no "may contain" or similar language. Structured output from Gemini: Getting consistent JSON from the model required a strict schema (Pydantic) and clear formatting rules. We added fallback logic for reasoning when the model didn't include preference-related text (e.g., "likely to enjoy based on reaction history").

Accomplishments that we're proud of

Personalized evidence-based analysis: We were able to provide suggestions that avoid harmful assumptions and only flag allergen risks when there is explicit evidence. Thorough Dietary Support: 12+ dietary options (halal, kosher, vegan, gluten-free, celiac, keto, FODMAP, renal, etc.) plus custom allergen lists. Reaction-Based Learning: Thumbs up/thumbs down feed into future analyses so recommendations improve over time. Shareable Safety Card: A simple, printable/shareable card for restaurants and hosts, generated from URL parameters without requiring login to view.

What we learned

Balance functionality with aesthetics, especially with the time constraint: In the beginning, we spent too much time on minimal details that simply didn’t really affect the general quality of life of the app. Working on a larger project using Git and Docker requires a lot of synchronization and communication between people. Building out a secure JWT authentication middleware that could verify users on the backend. Overall, learning how to collaborate effectively to complete a useful project.

What's next for SnackSafe

Mobile app for on-the-go scanning at restaurants and grocery stores. Barcode scanning for packaged foods, with integration to ingredient databases. Multi-language support for labels and descriptions, especially for international travel. Restaurant mode, which lets restaurants create and display safety cards for their menus. Nutrition insights that expand beyond safety to include macros, calories, and nutrition goals for users who want both safety and fitness tracking in one place.

Built With

Share this project:

Updates