FoodOrTrash
A food classification tool using a three-tier pipeline: database lookup, AI classification, and ingredient decomposition.

Problem
Consumers want a quick, trustworthy answer to "is this food actually good for me?" — but single-source classifiers give inconsistent results. Pure LLM answers hallucinate; pure database lookups miss anything novel; raw nutritional heuristics over-penalise nuance.
Approach
A three-tier pipeline. First, a local database of 1,345 hand-classified items (1,159 real foods and 186 trash items across 27 categories) returns a verdict for known inputs — fast and deterministic, with Fuse.js handling typos and plurals. If the item is unknown, Cloudflare Workers AI running Llama 3.1 8B classifies it with a whole-food-first prompt. For compound inputs like recipes, an ingredient-decomposition layer breaks the item into components, scores each, and weighs them into a composite 0–100 verdict — which keeps behaviour consistent across repeat queries for the same item. Built on Next.js and TypeScript with Tailwind and Framer Motion for the UI.
Stack
Synopsis
The scope is three classification tiers — curated lookup, AI fallback for unknowns, and ingredient decomposition for compound foods — plus editorial long-form that explains the scoring philosophy. The purpose is to give a consumer a trustworthy, consistent verdict on real-food-vs-processed for any input, with the reasoning exposed on the verdict card rather than hidden behind an opaque LLM call.
Outcome
Publicly live at foodortrash.com.
Gallery
The verdict surface

Browse the underlying database

Long-form context
