Public
Remixed
Cook with what you have — smart recipe finder & pantry tracker
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

🍽️ FoodLeft — Cook With What You Have

A smart ingredient-based recipe finder that helps you figure out what to cook based on what's already in your kitchen — reducing food waste and saving money.

How it works

  1. Add your ingredients to the Pantry tab (with optional quantity & expiry date)
  2. Find Recipes — see recipes ranked by match % based on your pantry
  3. Browse & add recipes in the Recipe Book tab

Features

  • 🥫 Pantry tracker — Add/remove ingredients with expiry date tracking
  • 🍳 Recipe matching — Set intersection algorithm ranks recipes by how many ingredients you already have
  • 📖 Recipe book — Pre-seeded with 12 common recipes; add your own
  • Expiry alerts — Visual badges for items expiring soon (yellow/orange/red)
  • 🔌 REST API — Full CRUD endpoints for pantry & recipes

Architecture

Rendering mermaid diagram...

File structure

index.ts                       ← Hono server (serves frontend + REST API)
db.ts                          ← Database schema + seed data
frontend/
  index.html                   ← HTML shell (Twind + React)
  index.tsx                    ← React entrypoint
  components/
    App.tsx                    ← Root layout with tab navigation
    Pantry.tsx                 ← Pantry management (add/remove ingredients)
    Match.tsx                  ← Recipe matching results view
    AddRecipe.tsx              ← Recipe book (browse/add/delete recipes)

API endpoints

MethodPathDescription
GET/api/pantryList all pantry items
POST/api/pantryAdd a pantry item {ingredient, quantity, expiry_date}
DELETE/api/pantry/:idRemove a pantry item
GET/api/recipesList all recipes
POST/api/recipesAdd a recipe {name, ingredients, instructions, difficulty}
DELETE/api/recipes/:idDelete a recipe
GET/api/matchGet all recipes ranked by pantry match %

Matching algorithm

match_score = (matched_ingredients / total_recipe_ingredients) × 100

Ingredients are matched using set intersection with fuzzy partial matching (e.g., "tomato" matches "tomatoes"). Results are sorted by match score descending.