Your Smart Kitchen Assistant for Zero Food Waste
SHPE Code for Change Hackathon 2026 | University of Florida Team ByteWaste: Matthew Segura, Brian Borrego, Adrian Lehnhaeuser, Sanjeev Kamath
Watch Full Demo on YouTube β
Americans waste 40% of the food they buy - that's over $1,500 per household per year and a massive contributor to climate change. Why? Because we forget what's in our fridge, lose track of expiration dates, and don't know what to cook with ingredients about to go bad.
UPantry is an iOS app that prevents household food waste through intelligent tracking, smart recipe suggestions, and gamified environmental impact. Simply scan, snap, or search to add items - then let AI do the heavy lifting.
- Barcode Scanning: Instant product recognition with camera
- Photo Recognition: AI identifies groceries from photos (powered by Edamam Vision API)
- Manual Search: Searchable database of thousands of food items
- Smart Storage: Organize items by Fridge, Freezer, or Shelf
- AI-Powered Estimates: Automatically calculates shelf life for each storage location
- Dynamic Recalculation: Moving chicken from fridge to freezer? Watch the expiration extend from 2 days to 90 days!
- Color-Coded Urgency: Red (β€3 days), Orange (4-7 days), Green (8+ days)
- Never Forget: Visual badges show exactly how much time is left
- "My Pantry" Recipes: Prioritizes recipes using ingredients about to expire
- Smart Scoring: Matches recipes based on what you have and what's going bad
- Missing Ingredients: Clearly highlights what you need to buy
- All Recipes Search: Browse thousands of recipes by keyword
- One-Tap Add: Missing ingredients automatically become shopping list items
- Source Tracking: Remember which recipe you're shopping for
- Simple Management: Check off items as you shop
- Image Preview: Visual confirmation of items to purchase
- Progress Trees: Watch your virtual forest grow as you prevent waste
- Visual Feedback: Every saved item contributes to environmental progress
- Sustainability Tracking: Earn points for reducing food waste
- Positive Reinforcement: Celebrate good habits with growth visualization
- Supabase Authentication: Secure login with email/password
- Apple Sign-In: Seamless authentication with Face ID/Touch ID
- Cloud Sync: Your pantry persists across sessions
- Row-Level Security: Each user's data is protected and isolated
- Profile Management: Track your personal environmental impact
| Component | Technology |
|---|---|
| Language | Swift 5.9+ |
| UI Framework | SwiftUI (iOS 17+) |
| Architecture | MVVM (Model-View-ViewModel) |
| Backend | Supabase (PostgreSQL Database + Authentication) |
| Authentication | Supabase Auth (Email/Password + Apple Sign-In) |
| APIs | Edamam Food Database API Edamam Recipe Search API Edamam Vision API Custom AI Service (Shelf Life Estimation) |
| Camera | AVFoundation (Barcode Scanning) |
| Image Recognition | Edamam Vision + Custom ML |
| Storage | Supabase PostgreSQL + Local UserDefaults |
| Security | Row-Level Security (RLS) Policies |
| Package Manager | Swift Package Manager (SPM) |
| Dependencies | supabase-swift, ConfettiSwiftUI |
- SwiftUI: Rapid development with declarative syntax, perfect for hackathons
- Supabase: Open-source Firebase alternative with PostgreSQL, real-time subscriptions, and built-in authentication
- Edamam APIs: Comprehensive food database with 1M+ items and 2M+ recipes
- MVVM Pattern: Clean separation of concerns for maintainable code
- Row-Level Security: Database-level security ensuring user data isolation
- macOS 14.0+ with Xcode 15.0+
- iOS 17.0+ device or simulator
- Apple Developer account (for device testing and Apple Sign-In)
- Supabase account (supabase.com)
- API Keys (see Configuration below)
-
Clone the repository
git clone https://github.com/yourusername/ByteWaste_C4C.git cd ByteWaste_C4C -
Open in Xcode
open ByteWaste_C4C.xcodeproj
-
Configure Supabase
Create a
SupabaseConfig.swiftfile in theByteWaste_C4Cfolder:enum SupabaseConfig { static let url = "https://YOUR_PROJECT_ID.supabase.co" static let anonKey = "YOUR_ANON_PUBLIC_KEY" }
Get these values from:
- Go to supabase.com/dashboard
- Select your project β Settings β API
- Copy "Project URL" and "anon public" key
Note:
SupabaseConfig.swiftis already in.gitignoreto protect your keys -
Configure Edamam APIs
Create a
Config.swiftfile in theByteWaste_C4Cfolder:enum Config { // Development mode toggle (set to false for production) static let isDevMode = true // Edamam Food Database API static let edamamFoodDBAppID = "YOUR_APP_ID" static let edamamFoodDBAppKey = "YOUR_APP_KEY" // Edamam Vision API static let edamamVisionAppID = "YOUR_APP_ID" static let edamamVisionAppKey = "YOUR_APP_KEY" // Edamam Recipe Search API static let edamamRecipeAppID = "YOUR_APP_ID" static let edamamRecipeAppKey = "YOUR_APP_KEY" // Custom AI Service (optional) static let aiServiceEndpoint = "YOUR_AI_ENDPOINT" static let aiServiceAPIKey = "YOUR_API_KEY" }
Get Edamam API keys:
- Sign up at developer.edamam.com
- Create applications for: Food Database API, Recipe Search API, Vision API
- Copy App ID and App Key for each
Note:
Config.swiftis already in.gitignore -
Set up Supabase Database
Run the following SQL in your Supabase SQL Editor:
-- Create pantry_items table CREATE TABLE pantry_items ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE, name TEXT NOT NULL, storage_location TEXT NOT NULL, scan_date TIMESTAMPTZ NOT NULL, current_expiration_date TIMESTAMPTZ NOT NULL, shelf_life_estimates JSONB, edamam_food_id TEXT, image_url TEXT, category TEXT, barcode TEXT, quantity TEXT, brand TEXT, notes TEXT, sustainability_notes TEXT, generic_name TEXT, amount_remaining REAL DEFAULT 1.0, created_at TIMESTAMPTZ DEFAULT NOW() ); -- Create recipes table CREATE TABLE recipes ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE, label TEXT NOT NULL, image TEXT, source_url TEXT, source_publisher TEXT, yield INT, total_time INT, ingredient_lines TEXT[], cuisine_type TEXT[], meal_type TEXT[], pantry_items_used TEXT[], expiring_items_used TEXT[], generated_from TEXT[], created_at TIMESTAMPTZ DEFAULT NOW() ); -- Create shopping_list_items table CREATE TABLE shopping_list_items ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE, name TEXT NOT NULL, is_completed BOOLEAN DEFAULT FALSE, date_added TIMESTAMPTZ DEFAULT NOW(), source_recipe_id TEXT, source_recipe_name TEXT, image_url TEXT ); -- Enable Row Level Security ALTER TABLE pantry_items ENABLE ROW LEVEL SECURITY; ALTER TABLE recipes ENABLE ROW LEVEL SECURITY; ALTER TABLE shopping_list_items ENABLE ROW LEVEL SECURITY; -- Create RLS policies for pantry_items CREATE POLICY "Users can view their own pantry items" ON pantry_items FOR SELECT USING (auth.uid() = user_id); CREATE POLICY "Users can insert their own pantry items" ON pantry_items FOR INSERT WITH CHECK (auth.uid() = user_id); CREATE POLICY "Users can update their own pantry items" ON pantry_items FOR UPDATE USING (auth.uid() = user_id); CREATE POLICY "Users can delete their own pantry items" ON pantry_items FOR DELETE USING (auth.uid() = user_id); -- Create RLS policies for recipes CREATE POLICY "Users can view their own recipes" ON recipes FOR SELECT USING (auth.uid() = user_id); CREATE POLICY "Users can insert their own recipes" ON recipes FOR INSERT WITH CHECK (auth.uid() = user_id); CREATE POLICY "Users can update their own recipes" ON recipes FOR UPDATE USING (auth.uid() = user_id); CREATE POLICY "Users can delete their own recipes" ON recipes FOR DELETE USING (auth.uid() = user_id); -- Create RLS policies for shopping_list_items CREATE POLICY "Users can view their own shopping list items" ON shopping_list_items FOR SELECT USING (auth.uid() = user_id); CREATE POLICY "Users can insert their own shopping list items" ON shopping_list_items FOR INSERT WITH CHECK (auth.uid() = user_id); CREATE POLICY "Users can update their own shopping list items" ON shopping_list_items FOR UPDATE USING (auth.uid() = user_id); CREATE POLICY "Users can delete their own shopping list items" ON shopping_list_items FOR DELETE USING (auth.uid() = user_id);
-
Configure Apple Sign-In (Optional)
- In Xcode: Add "Sign in with Apple" capability
- Apple Developer Portal:
- Create an App ID with "Sign in with Apple" enabled
- Create a Service ID
- Add redirect URLs:
https://YOUR_PROJECT_ID.supabase.co/auth/v1/callback
- Supabase Dashboard:
- Go to Authentication β Providers β Apple
- Enable Apple provider
- Enter Service ID and configure settings
-
Build and Run
- Select your target device/simulator
- Press
βRor click the Play button - Grant camera permissions when prompted
- Create an account or sign in
Bottom tab bar with 4 main sections:
- π₯ Pantry - Food inventory across Fridge/Freezer/Shelf
- π½ Recipes - Two tabs: "My Pantry" (expiring-focused) + "All Recipes" (search)
- π Shopping List - Simple checklist with add/delete/complete
- πΏ Sustainability - Environmental impact visualization with progress trees
struct PantryItem: Identifiable, Codable {
let id: UUID
var name: String
var storageLocation: StorageLocation // fridge, freezer, or shelf
let scanDate: Date // Never changes - original add date
var currentExpirationDate: Date
var shelfLifeEstimates: ShelfLifeEstimates // AI estimates for all 3 storage types
var edamamFoodId: String?
var imageURL: String?
var category: String?
var barcode: String?
var quantity: String?
var brand: String?
var amountRemaining: Double // 0.0 to 1.0
// ... additional fields
}
struct ShelfLifeEstimates: Codable {
let fridgeDays: Int
let freezerDays: Int
let shelfDays: Int
}
enum StorageLocation: String, Codable {
case fridge, freezer, shelf
}struct Recipe: Identifiable, Codable {
let id: UUID
var label: String
var image: String?
var sourceUrl: String?
var sourcePublisher: String?
var yield: Int?
var totalTime: Int?
var ingredientLines: [String]
var cuisineType: [String]?
var mealType: [String]?
var pantryItemsUsed: [String]
var expiringItemsUsed: [String]
var generatedFrom: [String]
var userId: UUID?
}struct ShoppingListItem: Identifiable, Codable {
let id: UUID
var name: String
var isCompleted: Bool
let dateAdded: Date
var sourceRecipeId: String?
var sourceRecipeName: String?
var imageURL: String?
var userId: UUID?
}Barcode Scanning
User scans barcode β Query Edamam Food DB β Get product details β
AI estimates shelf life β User confirms storage β Add to pantry
Photo Recognition
User takes photo β Upload to Edamam Vision API β AI identifies food β
Query Food DB for details β AI estimates shelf life β Add to pantry
Manual Entry
User types food name β Search Edamam Food DB (debounced) β
Select from dropdown β AI estimates shelf life β Add to pantry
The Key Insight: Each item stores its scanDate (never changes) and shelfLifeEstimates for all 3 storage types.
Rules:
- Moving TO Freezer: Full freezer estimate (freezing preserves)
- Moving FROM Freezer: Full new storage estimate (thawing resets clock)
- Fridge β Shelf: Adjust for time elapsed since scan date
Example:
Chicken scanned 2 days ago (Fridge: 2d, Freezer: 90d)
Current location: Fridge, expires in 2 days
User drags to Freezer:
β New expiration = Today + 90 days β¨
User drags back to Fridge:
β New expiration = Today + 2 days (thawing resets)
Goal: Find recipes using expiring items (β€3 days), allow β€3 missing ingredients
Process:
- Identify expiring items (β€3 days)
- Generate search queries (individual items, pairs, triples)
- Query Edamam Recipe API multiple times
- For each recipe:
- Compare ingredients to pantry (fuzzy string matching)
- Count: available, missing, expiring items used
- Calculate match percentage
- Score each recipe:
- Base:
matchPercentage Γ 100 - Bonus:
+25 points per expiring item used - Penalty:
-5 points per missing ingredient
- Base:
- Filter: Keep only β€3 missing ingredients
- Sort by score descending
- Return top 15-20 recipes
Perfect sequence for presentations:
- Start with Loading Screen - Beautiful tree animation on launch
- Login/Sign Up - Create account with email or Apple Sign-In
- Empty Pantry State - Show clean, inviting interface
- Barcode Scan Milk - Quickest input method
- Photo Scan Bananas - AI vision capability
- Manual Entry Chicken - Search functionality
- View Pantry - 3 storage sections organized with expiration badges
- Drag Chicken to Freezer - Show expiration change (2d β 90d)
- Adjust Date (Dev Mode) - Make chicken "expire in 2 days"
- Open "My Pantry" Recipes - See chicken-focused recipes
- Tap Recipe Detail - Show missing ingredients highlighted
- Add to Shopping List - Demonstrate integration
- View Shopping List - Show added ingredients with images
- Check Off Items - Complete interaction
- Sustainability Tab - Show environmental progress tree and points
Event: SHPE Code for Change 2026 Location: University of Florida Theme: Environmental Sustainability Duration: 24-48 hours Team: ByteWaste (Matthew Segura, Brian Borrego, Adrian Nguyen, Sanjeev Rajagopal)
- β Address environmental challenge (food waste)
- β Real-world impact (save money + reduce emissions)
- β Technical complexity (multiple APIs, AI integration, complex algorithms)
- β User experience focus (3 input methods, gamification)
- β Scalability (MVVM architecture, cloud backend with RLS)
- β Security (Row-Level Security policies, Apple Sign-In)
- β Polish (Custom loading screen, animations, confetti effects)
Environmental:
- 40% of US food supply is wasted annually
- Food waste = 3rd largest source of methane emissions
- 1 lb of wasted food = 3.3 lbs CO2 equivalent
Personal:
- Average household wastes $1,500/year on food
- 25% of household carbon footprint from food waste
- UPantry helps recover 80%+ of expiring items
ByteWaste_C4C/
βββ Views/
β βββ ContentView.swift // Main tab container
β βββ LoginView.swift // Authentication UI
β βββ TreeLoadingView.swift // Animated loading screen
β βββ PantryView.swift // Pantry management
β βββ RecipeListView.swift // Recipe browsing
β βββ ShoppingListView.swift // Shopping list
β βββ ProgressTreeView.swift // Sustainability visualization
β βββ ProfileView.swift // User profile
β βββ BarcodeScannerView.swift // Barcode scanning
β βββ RealtimeCameraView.swift // Photo capture
β βββ CustomTabBar.swift // Custom tab navigation
βββ ViewModels/
β βββ PantryViewModel.swift // Pantry business logic
β βββ RecipeViewModel.swift // Recipe matching logic
β βββ ShoppingListViewModel.swift // Shopping list logic
β βββ AuthViewModel.swift // Authentication logic
βββ Models/
β βββ Recipe.swift // Recipe data model
β βββ (PantryItem, ShoppingListItem defined in ViewModels)
βββ Services/
β βββ SupabaseService.swift // Supabase CRUD operations
β βββ RecipeService.swift // Edamam Recipe API
β βββ FoodExpirationService.swift // Shelf life AI
β βββ ImageClassificationService.swift // Edamam Vision API
β βββ FoodImageService.swift // Food image fetching
βββ Utilities/
β βββ TreeView.swift // Custom tree animation (UIKit)
β βββ AppTheme.swift // Color and style constants
β βββ ConfettiManager.swift // Celebration effects
β βββ COLORS_CONSTANT.swift // Color definitions
βββ Configuration/ (gitignored)
β βββ SupabaseConfig.swift // Supabase credentials
β βββ Config.swift // API keys
βββ Resources/
βββ Assets.xcassets // Images and icons
- Row-Level Security: Database policies ensure users only access their own data
- Local-First Design: Data cached locally for offline access
- Secure Authentication: Supabase Auth with encrypted credentials
- Apple Sign-In: Biometric authentication support
- No Tracking: We don't collect analytics or personal data beyond what's needed
- Image Privacy: Photos processed via API, not stored permanently
- Data Ownership: Users can delete all data from their account
- User Isolation: Each user's data is scoped by user_id
- Barcode Database: Not all products have barcode entries (suggest photo/manual)
- Vision API Accuracy: Photo recognition works best with clear, well-lit images
- Recipe Matching: Fuzzy string matching may miss some ingredient variations
- Expiration Estimates: AI estimates are approximations (user can override)
- Offline Mode: Limited - requires internet for initial item lookup
- Loading Time: Minimum 5.5s loading animation (can be adjusted in Config)
- Push notifications for expiring items
- Batch item entry from grocery receipts (OCR)
- Apple Watch complications for quick pantry view
- Siri Shortcuts integration ("Add milk to UPantry")
- Shopping list optimization by store layout
- Export pantry to PDF/CSV
- Household sharing (family accounts)
- Community recipe sharing and ratings
- Integration with grocery delivery services (Instacart, Amazon Fresh)
- Meal planning calendar with automated shopping lists
- Donation suggestions for excess food
- Food bank partnerships
- Carbon footprint leaderboards
- Computer vision for expiration date reading from packaging
- Voice commands for hands-free pantry management
- Smart home integration (sync with smart fridges)
We welcome contributions! This project was built for a hackathon but has potential for real-world impact.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Swift naming conventions
- Use MVVM architecture pattern
- Add comments for complex logic
- Test on multiple iOS devices/sizes
- Ensure RLS policies are respected
This project is licensed under the MIT License - see the LICENSE file for details.
- SHPE (Society of Hispanic Professional Engineers) - For hosting Code for Change 2026
- University of Florida - For providing venue and resources
- Edamam - For comprehensive food and recipe APIs
- Supabase - For open-source backend infrastructure
- OpenAI/Claude - For AI-powered development assistance and shelf life estimation
Team: ByteWaste Project: UPantry Hackathon: SHPE Code for Change 2026 University: University of Florida
Team Members:
- Matthew Segura
- Brian Borrego
- Adrian Nguyen
- Sanjeev Rajagopal
If UPantry helped you reduce food waste or inspired your own project, please consider starring this repository! β
Built with β€οΈ and β at SHPE Code for Change 2026
Waste Less. Save More. Eat Better. π±
