Skip to content

About

An app that lets you take pictures of your fridge and give you back possible recipes based on the fridge pictures

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

442 Commits

Folders and files

Repository files navigation

Netlify Status Next.js React TypeScript Google Gemini Supabase License: MIT

Turn fridge-gazing into meal-making while fighting food waste.

Live Demo β€’ Report Bug β€’ Request Feature


πŸ“Œ Table of Contents


πŸ’‘ About SnapFridge

Around 30% to 40% of the food supply in the United States is wasted each year (USDA), amounting to over 60 million metric tons (or 133 billion pounds) of discarded food sent to landfills. Much of this waste begins at home with unopened, forgotten groceries and clueless fridge-gazing.

SnapFridge tackles this problem head-on:

  1. Snap: Take photos of what is inside your refrigerator or pantry.
  2. Scan: Multimodal AI extracts and identifies raw ingredients against a verified master ingredient dataset.
  3. Cook: Instant recipe suggestions maximize the ingredients you already own, complete with nutritional breakdowns, allergen warnings, and step-by-step directions.

✨ Key Features

  • πŸ“Έ AI-Powered Image Recognition

    • Upload photos of your fridge contents (.png, .jpg, .webp).
    • Analyzed by Google Gemini 2.5 Flash using streaming responses to identify food ingredients against a master catalog while filtering out containers, brands, and non-food items.
  • πŸ₯• Interactive Ingredient Control

    • Add, remove, or modify detected ingredients in real time.
    • Searchable autocomplete ingredient input with fuzzy suggestions.
    • Option to ignore common pantry staples (water, flour, salt, oil) to focus on key perishable items.
    • Ranking selector: choose whether to maximize used ingredients or minimize missing ones.
  • 🍳 Recipe Suggestions & Smart Filtering

    • Powered by the Spoonacular API to find recipes matching your available items.
    • Displays missing vs. used ingredient counts directly on recipe cards.
    • Client-side pagination and responsive grid views.
  • πŸ₯— In-Depth Recipe Details

    • Full ingredient lists with dynamic Metric / US Customary measurement toggling.
    • Comprehensive nutritional profiles (calories, macros, vitamins, and minerals).
    • Allergen warnings (dairy, gluten, nuts, soy, etc.).
    • Dietary and quality tags (vegan, vegetarian, healthy, sustainable, popular).
    • Clear step-by-step cooking instructions with source attribution.
  • πŸ‘€ User Accounts & Recipe Book

    • Secure authentication via Supabase Auth supporting Google and GitHub OAuth.
    • Personal Dashboard to bookmark and manage saved recipes.
  • 🎨 Modern, Performant UI & UX

    • Built with React 19 and the React Compiler for automatic memoization and optimal rendering.
    • Zero-runtime CSS-in-JS via Pigment CSS (@pigment-css/react) and Lightning CSS.
    • Fluid typography and responsive layouts using mathematical clamp scaling.
    • Dark and light theme switcher with persistent user preference.
    • Accessible UI primitives backed by Radix UI.

πŸ›  Tech Stack

Domain Technology Description
Framework Next.js 16 App Router, Server Components, Server Actions, Partial Prerendering
UI Library React 19 Using the React Compiler for automatic memoization
Styling Pigment CSS & Lightning CSS Zero-runtime CSS extraction and performant CSS transforms
AI / Vision Google Gemini 2.5 Flash Multimodal image understanding via @google/genai
Recipe Data Spoonacular API Recipe search, ingredient parsing, and detailed nutrition data
Backend & Auth Supabase PostgreSQL database, Row-Level Security, and OAuth (Google, GitHub)
Animations & Icons Motion & Lucide React Smooth transitions, micro-interactions, and consistent iconography
State & Data Fetching SWR & Immer Client-side caching and immutable state management
Linter & Formatter Biome Fast Rust-based linting and code formatting
Hosting & CI/CD Netlify & GitHub Actions Automated branch previews, edge deployments, and security headers

πŸ“‚ Project Architecture

SnapFridge/
β”œβ”€β”€ public/                 # Static assets, branding, and manifest icons
β”‚   β”œβ”€β”€ functions/
β”‚   β”‚   └── ingredients.csv # Master ingredient taxonomy used for AI grounding
β”‚   └── ...
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                # Next.js App Router routes & API endpoints
β”‚   β”‚   β”œβ”€β”€ (home)/         # Landing page with interactive demo and statistics
β”‚   β”‚   β”œβ”€β”€ about/          # Mission statement & team information
β”‚   β”‚   β”œβ”€β”€ auth/           # OAuth callback handler for Supabase
β”‚   β”‚   β”œβ”€β”€ credits/        # Image, data, and library attributions
β”‚   β”‚   β”œβ”€β”€ dashboard/      # User dashboard & saved recipes
β”‚   β”‚   β”œβ”€β”€ gemini/         # Streamed multimodal AI inference route
β”‚   β”‚   β”œβ”€β”€ login/          # OAuth login page
β”‚   β”‚   β”œβ”€β”€ privacy-policy/ # Privacy policy
β”‚   β”‚   β”œβ”€β”€ recipe/[id]/    # Dynamic recipe details & nutrition page
β”‚   β”‚   └── snap/           # Fridge photo uploader & ingredient curation
β”‚   β”œβ”€β”€ components/         # Modular React UI components
β”‚   β”‚   β”œβ”€β”€ NavBar/         # Header navigation, theme switch & auth status
β”‚   β”‚   β”œβ”€β”€ RecipeSection/  # Recipe cards, pagination, and skeleton loaders
β”‚   β”‚   β”œβ”€β”€ ThemeSwitch/    # Light / dark theme toggle
β”‚   β”‚   β”œβ”€β”€ ToastProvider/  # Global toast notification system
β”‚   β”‚   β”œβ”€β”€ UnitProvider/   # US Metric / Imperial conversion context
β”‚   β”‚   β”œβ”€β”€ UserProvider/   # Supabase user authentication state
β”‚   β”‚   └── snap/           # Image upload dropsite and ingredient chips
β”‚   └── utils/              # Helper utilities, design tokens, and Supabase clients
β”‚       └── supabase/       # Client, server, and admin Supabase instances
β”œβ”€β”€ .env.example            # Template for required environment variables
β”œβ”€β”€ biome.json              # Biome linter and formatter configuration
β”œβ”€β”€ netlify.toml            # Netlify deployment and HTTP security headers
β”œβ”€β”€ next.config.ts          # Pigment CSS, CSP headers, and Next.js configuration
└── package.json            # Dependencies and npm scripts

πŸš€ Getting Started

Prerequisites

Ensure you have the following installed on your machine:

  • Node.js: >= 20.12.2
  • npm: >= 10.9.2

Installation

  1. Clone the repository:

    git clone https://github.com/SnapFridge/SnapFridge.git
    cd SnapFridge
  2. Install project dependencies:

    npm install

Environment Variables

Copy the sample environment file to create .env:

cp .env.example .env

Open .env and fill in the following credentials:

Variable Description Source
GEMINI_API_KEY Google Gemini API Key for fridge image ingredient extraction Google AI Studio
SPOONACULAR_KEY Spoonacular API Key for recipe queries and nutrition facts Spoonacular Food API
NEXT_PUBLIC_SUPABASE_URL Supabase Project URL for authentication and database Supabase Dashboard
NEXT_PUBLIC_SUPABASE_KEY Supabase Public / Anon Key Supabase Dashboard
SUPABASE_SECRET_KEY Supabase Service Role Key (used server-side for admin actions) Supabase Dashboard

Running Locally

Start the development server with Next.js and Webpack (configured for Pigment CSS):

npm run dev

Open http://localhost:3000 in your browser.


πŸ“œ Available Scripts

Command Description
npm run dev Runs the Next.js development server
npm run build Builds the production application for deployment
npm run start Starts the production server
npm run check Checks formatting and runs linter via Biome
npm run fix Automatically fixes lint and formatting issues via Biome
npm run update Checks and updates dependencies interactively
npm run new-component Scaffolds a new TypeScript component

πŸ—„ Database Setup

SnapFridge utilizes Supabase (PostgreSQL) for user recipe bookmarks.

Create the saved_recipes table using the following SQL in your Supabase SQL editor:

create table public.saved_recipes (
  id uuid references auth.users(id) on delete cascade primary key,
  recipes jsonb default '[]'::jsonb
);

-- Enable Row Level Security (RLS)
alter table public.saved_recipes enable row level security;

-- Policy: Allow users to view their own saved recipes
create policy "Users can view their own saved recipes"
  on public.saved_recipes for select
  using (auth.uid() = id);

-- Policy: Allow users to insert their own saved recipes row
create policy "Users can insert their own saved recipes"
  on public.saved_recipes for insert
  with check (auth.uid() = id);

-- Policy: Allow users to update their own saved recipes
create policy "Users can update their own saved recipes"
  on public.saved_recipes for update
  using (auth.uid() = id);

πŸ‘₯ The Team

Created with passion by high school students at Cypress High School:

  • Rylex Phan β€” Backend architecture, AI streaming pipeline, and system integration.
  • Andrew "Andru" Trinh β€” Full-stack development, database schema, and recipe flows.
  • Andrew "Xandrew" Kim β€” Frontend interface, design system, and responsive UI components.

πŸ’– Credits & Acknowledgments


πŸ“„ License

This project is licensed under the MIT License.

About

An app that lets you take pictures of your fridge and give you back possible recipes based on the fridge pictures

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages