Turn fridge-gazing into meal-making while fighting food waste.
Live Demo β’ Report Bug β’ Request Feature
- About SnapFridge
- Key Features
- Tech Stack
- Project Architecture
- Getting Started
- Available Scripts
- Database Setup
- The Team
- Credits & Acknowledgments
- License
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:
- Snap: Take photos of what is inside your refrigerator or pantry.
- Scan: Multimodal AI extracts and identifies raw ingredients against a verified master ingredient dataset.
- Cook: Instant recipe suggestions maximize the ingredients you already own, complete with nutritional breakdowns, allergen warnings, and step-by-step directions.
-
πΈ 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.
- Upload photos of your fridge contents (
-
π₯ 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.
| 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 |
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
Ensure you have the following installed on your machine:
- Node.js:
>= 20.12.2 - npm:
>= 10.9.2
-
Clone the repository:
git clone https://github.com/SnapFridge/SnapFridge.git cd SnapFridge -
Install project dependencies:
npm install
Copy the sample environment file to create .env:
cp .env.example .envOpen .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 |
Start the development server with Next.js and Webpack (configured for Pigment CSS):
npm run devOpen http://localhost:3000 in your browser.
| 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 |
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);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.
- Food Waste Photography: Sarah Reingewirtz / ZUMA Press / Newscom
- Refrigerator Imagery: Sharp Electronics Corporation
- Food Waste Statistics: United States Department of Agriculture (USDA)
- Privacy Policy Template: Generated via TermsFeed
This project is licensed under the MIT License.