Project Info
Foodsafe - AI-Powered Food Bank Management System
A comprehensive food bank management system that leverages AI to streamline inventory management, food recognition, and recipe generation. Built with React, TypeScript, and integrated with multiple AI services.
CalHacks 12.0 Creao.AI Best Design Winners
Created by Eric Wu, Ethan Lai, Maleeka Raddygala, and William Wang
- UI and Integration by Eric
- Recipe Generation & Inventory Logging Algo by Ethan
- ML Image Processing by Maleeka
- Barcode Scanning Database by William
Devpost: Calhacks 12.0 Hackathon Submission
π Live Demo
β¨ Key Features
π¦ Smart Inventory Management
- Real-time inventory tracking with quantity management
- Advanced filtering by dietary preferences and allergens
- Low stock alerts and automated notifications
- Nutritional information display for each item
- Image support with automatic product photos
πΈ AI-Powered Food Recognition
- Barcode scanning with OpenFoodFacts integration
- Computer vision for automatic food detection from photos
- Nutritional analysis using ImgRecModel AI
- Product information lookup with detailed nutritional data
- Allergen detection and dietary tag classification
π³ Intelligent Recipe Generation
- AI-generated recipes based on available inventory
- Dietary restriction support (vegetarian, vegan, gluten-free, etc.)
- Serving size optimization with inventory validation
- Recipe bundling for efficient meal planning
- Automatic ingredient deduction when recipes are used
π§ Technical Features
- Modern React architecture with TypeScript
- Responsive design optimized for mobile and desktop
- Real-time data synchronization with local storage
- RESTful API integration with multiple AI services
- Comprehensive error handling and user feedback
ποΈ Architecture
Frontend (Creao_Codebase)
- React 19 with TypeScript
- TanStack Router for navigation
- TanStack Query for data management
- Radix UI components with Tailwind CSS
- Local storage with IndexedDB for offline capability
Backend APIs
- Recipe Generation API - Google Gemini AI integration
- OpenFoodFacts API - Product database integration
π Getting Started
API Setup
Recipe Generation API
cd APIs/API_generateRecipes
pip install -r requirements.txt
# Set GOOGLE_API_KEY environment variable
OpenFoodFacts API
cd APIs/API_openFoodFacts
npm install
# Deploy to Vercel
π± Usage Guide
Adding Items to Inventory
- Camera Tab: Take photos of food items for AI recognition
- Barcode Tab: Enter product barcodes for instant lookup
- Review: Edit detected information before saving
- Save: Items are automatically added to inventory
Managing Inventory
- View Items: Browse all inventory with search and filters
- Adjust Quantities: Use quick adjust buttons or set exact amounts
- Nutritional Info: View detailed nutritional data for each item
- Allergen Warnings: See allergen information and dietary tags
Generating Recipes
- Recipes Tab: Access the recipe generation interface
- Set Servings: Specify total number of servings needed
- AI Generation: System generates 3 unique recipes from available inventory
- Review Recipes: Check ingredients and cooking instructions
- Make Recipe: Deduct ingredients from inventory when cooking
π§ Configuration
Environment Variables
# Recipe Generation API
GOOGLE_API_KEY=your_google_api_key
API_KEY=your_optional_api_key
# Barcode Scanner API
GOOGLE_APPLICATION_CREDENTIALS=path_to_service_account.json
# OpenFoodFacts API
# No authentication required
API Endpoints
- Recipe Generation:
POST /api/generate_recipes - OpenFoodFacts:
GET /v1/products/{barcode}
π οΈ Development
Project Structure
calhacks/
βββ Creao_Codebase/ # React frontend application
β βββ src/
β β βββ components/ # UI components
β β βββ hooks/ # Custom React hooks
β β βββ routes/ # Application routes
β β βββ lib/ # Utilities and types
βββ APIs/ # Backend API services
β βββ API_generateRecipes/ # Recipe generation service
β βββ API_openFoodFacts/ # Product lookup service
Available Scripts
# Frontend development
npm run dev # Start development server
npm run build # Build for production
npm run check # Run type checking and linting
npm run test # Run test suite
# API development
python main.py # Start API server
python test_api.py # Run API tests
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- OpenFoodFacts for comprehensive product database
- Google Gemini AI for intelligent recipe generation
- ImgRecModel for nutritional analysis
- Creao platform for rapid application development
Built with β€οΈ for food banks and community organizations
Analysis
View
Metric
- 5
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- ExpressIn code
- HTMLIn code
- JavaScriptIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
- FlaskClaimed
- Google GeminiClaimed
- Node.jsClaimed
- VercelClaimed
8 of 12 appear in the indexed code. 4 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
726 KB
Source files
200
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
ericrcwu001/calhacks
246 files Β· 1.3 MB Β· @ 9919a5f
Structure
Interface
58 files Β· 24%Screens, components and styles rendered to the user.
API & routing
10 files Β· 4%Request entry points: routes, handlers and controllers.
Application logic
46 files Β· 19%Domain rules, services and shared utilities.
Data & schema
68 files Β· 28%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here β open the file browser to check anything the diagram implies.
Languages
- TypeScript71%
- Python12%
- Markdown9%
- JavaScript4%
- Shell3%
- CSS1%
- Other (1)0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
Creao_Codebase/package.json
npm Β· 85- @fortawesome/fontawesome-svg-core
- @fortawesome/free-brands-svg-icons
- @fortawesome/react-fontawesome
- @hookform/resolvers
- @protobuf-ts/runtime
- @radix-ui/react-accordion
- @radix-ui/react-alert-dialog
- @radix-ui/react-aspect-ratio
- @radix-ui/react-avatar
- @radix-ui/react-checkbox
- @radix-ui/react-collapsible
- @radix-ui/react-context-menu
- @radix-ui/react-dialog
- @radix-ui/react-dropdown-menu
- @radix-ui/react-hover-card
- @radix-ui/react-label
- @radix-ui/react-menubar
- @radix-ui/react-navigation-menu
- +67 more
APIs/API_ImageRecognitionAI/requirements.txt
pypi Β· 5- google-genai
- pandas
- Pillow
- requests
- werkzeug
APIs/API_openFoodFacts/package.json
npm Β· 4- axios
- cors
- express
- lru-cache
APIs/API_generateRecipes/requirements.txt
pypi Β· 1- requests
Declared in the repositoryβs manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
Feature verification
Advanced filtering by dietary preference and allergensVerified
Advanced filtering by dietary preferences and allergens
Claimed on readmehigh confidenceCreao_Codebase/src/routes/index.tsx:310β filter logic excludes items with selected allergens and matches selected dietary tags
AI camera/computer-vision food recognitionVerified
Computer vision for automatic food detection from photos using ImgRecModel AI
Claimed on readmehigh confidenceCreao_Codebase/src/routes/index.tsx:1617β CameraView calls vision classification then the ImgRecModel API on the captured photoCreao_Codebase/src/hooks/use-img-rec-model.ts:1β hook wraps the ImgRecogModel API client and defines nutritional response typesAPIs/API_ImageRecognitionAI/api/image-recognition.pyβ backend image recognition service implementing food detection
AI recipe generation via GeminiVerified
AI-generated recipes based on available inventory using Google Gemini
Claimed on readmehigh confidenceCreao_Codebase/src/hooks/use-recipe-generator.ts:1β recipe generator hook and types for inventory-based recipe suggestionsAPIs/API_generateRecipes/api/recipe_generator.py:42β RecipeGenerator class uses gemini-2.5-flash model and GOOGLE_API_KEY to generate recipes
Automatic ingredient deduction from recipesVerified
Automatic ingredient deduction when recipes are used / recipe bundling
Claimed on readmehigh confidenceCreao_Codebase/src/routes/index.tsx:2718β makeRecipe mutation deducts ingredient quantities from inventory when a recipe is cooked
Barcode scanning with OpenFoodFacts lookupVerified
Barcode scanning with OpenFoodFacts integration for instant product lookup
Claimed on readmehigh confidenceCreao_Codebase/src/routes/index.tsx:1843β handleBarcodeSubmit calls lookupBarcode mutation and inserts item/intake with barcode as sourceCreao_Codebase/src/hooks/use-openfoodfacts.ts:6β useOpenFoodFactsMutation hook defines OpenFoodFactsInput/Product types used for the lookupAPIs/API_openFoodFacts/server.jsβ backend Express service implementing the OpenFoodFacts product lookup API
Dietary restriction support in recipesVerified
Dietary restriction support (vegetarian, vegan, gluten-free, etc.) in recipe generation
Claimed on readmemedium confidenceCreao_Codebase/src/hooks/use-recipe-generator.ts:30β GenerateRecipesInput has a dietaryRestrictions field passed to the generator
Live/real-time inventory synchronizationVerified
Live inventory tracking with real-time data synchronization
Claimed on readmemedium confidenceCreao_Codebase/src/routes/index.tsx:1783β React Query cache invalidation on items/intakes after mutations keeps inventory views in sync
Nutritional info and allergen/dietary tag displayVerified
Nutritional information display and allergen detection / dietary tag classification
Claimed on readmehigh confidenceCreao_Codebase/src/routes/index.tsx:292β collects allergens and dietary_tags from inventory items and filters the list by themCreao_Codebase/src/routes/index.tsx:1740β calories/protein/carbs/fat/sodium nutritional fields saved on item records
Real-time inventory tracking with quantity managementVerified
Real-time inventory tracking with quantity management
Claimed on readmehigh confidenceCreao_Codebase/src/routes/index.tsx:350β setAbsoluteQuantity mutation and quantity adjustment UI update item quantities live via React Query invalidation
Add weight during intakeCode-supported
Scan, auto-fill, add weight during item intake
Claimed on Devpostmedium confidenceCreao_Codebase/src/routes/index.tsx:1420β Quantity per Unit field with a unit selector (supports g/kg) lets the user record item weight during intakeCreao_Codebase/src/components/data/schema/intake.json:75β intake schema has a weight_kg field, but it is not populated by the save-item mutation in index.tsx, so the weight-recording path is only partially wired
Faster check-ins via phone-as-scanner workflowCode-supported
Any phone becomes a scanner for faster food bank check-ins
Claimed on Devpostmedium confidenceCreao_Codebase/src/routes/index.tsx:1521β CameraView component supports both camera vision capture and manual/scanned barcode entry as mobile-friendly intake paths, but no dedicated hardware scanner integration was found
Instant CSV export for auditsClaimed only
Live inventory + instant CSVs for audits
Claimed on Devposthigh confidenceLow stock alerts / automated notificationsClaimed only
Low stock alerts and automated notifications
Claimed on readmehigh confidenceOffline capability with local IndexedDB storageClaimed only
Local storage with IndexedDB for offline capability
Claimed on readmehigh confidence
An AI agent derived these features from the projectβs Devpost page and readme, then searched the code for each one. Verified features are backed by cited code; claimed-only features had no supporting code, which is not by itself proof a feature is missing.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.