# Project export: AI-Powered Food Bank Management System

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 12.0
- Tagline: Food banks lose time at intake. Our web app makes any phone a scanner: scan, auto-fill, add weight. Live inventory + instant CSVs for audits. Faster check-ins mean more families served, less waste.
- Devpost: https://devpost.com/software/foodbank-automation
- GitHub: https://github.com/ericrcwu001/calhacks
- Demo: https://production.creao.ai/share?app=TW8zO4eq&utm_source=share&utm_medium=link
- Video: https://www.youtube.com/embed/rw9_SdR0mUo?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Result: winner (Creao: Best Designed Web App)
- Team: 1 GitHub contributor(s) — eric (5 commits)

## Devpost submission (written by the team)

No Devpost description available.

## README (from the GitHub repository)

# 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](https://devpost.com/software/foodbank-automation)
## 🚀 Live Demo

**[Try Creao Now](https://production.creao.ai/share?app=TW8zO4eq&utm_source=share&utm_medium=link)**


## ✨ 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
```bash
cd APIs/API_generateRecipes
pip install -r requirements.txt
# Set GOOGLE_API_KEY environment variable
```

#### OpenFoodFacts API
```bash
cd APIs/API_openFoodFacts
npm install
# Deploy to Vercel
```

## 📱 Usage Guide

### Adding Items to Inventory
1. **Camera Tab**: Take photos of food items for AI recognition
2. **Barcode Tab**: Enter product barcodes for instant lookup
3. **Review**: Edit detected information before saving
4. **Save**: Items are automatically added to inventory

### Managing Inventory
1. **View Items**: Browse all inventory with search and filters
2. **Adjust Quantities**: Use quick adjust buttons or set exact amounts
3. **Nutritional Info**: View detailed nutritional data for each item
4. **Allergen Warnings**: See allergen information and dietary tags

### Generating Recipes
1. **Recipes Tab**: Access the recipe generation interface
2. **Set Servings**: Specify total number of servings needed
3. **AI Generation**: System generates 3 unique recipes from available inventory
4. **Review Recipes**: Check ingredients and cooking instructions
5. **Make Recipe**: Deduct ingredients from inventory when cooking

## 🔧 Configuration

### Environment Variables
```bash
# 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
```bash
# 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](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**


## Detected evidence (automated analysis)

Indexed codebase: 200 recognized source files, 726 KB.
- CSS (language) — detected in the code
- Express (technology) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- Flask (technology) — claimed on Devpost, not found in the code
- Google Gemini (technology) — claimed on Devpost, not found in the code
- Node.js (technology) — claimed on Devpost, not found in the code
- Vercel (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (120 of 240)

```
.DS_Store
.gitignore
APIs/API_generateRecipes/.gitignore
APIs/API_generateRecipes/API_USAGE.md
APIs/API_generateRecipes/api/.gitignore
APIs/API_generateRecipes/api/generate_recipes.py
APIs/API_generateRecipes/api/index.py
APIs/API_generateRecipes/api/models.py
APIs/API_generateRecipes/api/recipe_generator.py
APIs/API_generateRecipes/api/test.py
APIs/API_generateRecipes/deploy.sh
APIs/API_generateRecipes/DEPLOYMENT_SUCCESS.md
APIs/API_generateRecipes/EDGE_CASE_HANDLING.md
APIs/API_generateRecipes/env.example
APIs/API_generateRecipes/openapi.json
APIs/API_generateRecipes/QUICKSTART.md
APIs/API_generateRecipes/README.md
APIs/API_generateRecipes/requirements.txt
APIs/API_generateRecipes/test_api.py
APIs/API_generateRecipes/test_comprehensive.py
APIs/API_generateRecipes/test_debug.py
APIs/API_generateRecipes/test_different.py
APIs/API_generateRecipes/test_edge_cases.py
APIs/API_generateRecipes/test_gemini_basic.py
APIs/API_generateRecipes/test_gemini_local.py
APIs/API_generateRecipes/test_input_minimal.json
APIs/API_generateRecipes/test_input_vegan.json
APIs/API_generateRecipes/test_input_vegetarian.json
APIs/API_generateRecipes/test_input.json
APIs/API_generateRecipes/test_modified.py
APIs/API_generateRecipes/test_nutrition_full.py
APIs/API_generateRecipes/TEST_RESULTS.md
APIs/API_generateRecipes/test_servings_demo.py
APIs/API_generateRecipes/test_target_servings.json
APIs/API_generateRecipes/vercel.json
APIs/API_ImageRecognitionAI/.gitignore
APIs/API_ImageRecognitionAI/.vercelignore
APIs/API_ImageRecognitionAI/API_DOCUMENTATION.md
APIs/API_ImageRecognitionAI/API_URLS.md
APIs/API_ImageRecognitionAI/api/image-recognition.py
APIs/API_ImageRecognitionAI/DEPLOYMENT.md
APIs/API_ImageRecognitionAI/FINAL_STATUS.md
APIs/API_ImageRecognitionAI/HOW_TO_USE.md
APIs/API_ImageRecognitionAI/openapi.json
APIs/API_ImageRecognitionAI/QUICK_START.md
APIs/API_ImageRecognitionAI/README.md
APIs/API_ImageRecognitionAI/requirements.txt
APIs/API_ImageRecognitionAI/SUMMARY.md
APIs/API_ImageRecognitionAI/test_local.py
APIs/API_ImageRecognitionAI/TROUBLESHOOTING.md
APIs/API_ImageRecognitionAI/UPDATED_FEATURES.md
APIs/API_openFoodFacts/.gitignore
APIs/API_openFoodFacts/creao-api-config.json
APIs/API_openFoodFacts/env.example
APIs/API_openFoodFacts/openapi-spec.json
APIs/API_openFoodFacts/package.json
APIs/API_openFoodFacts/README-Creo-Integration.md
APIs/API_openFoodFacts/README.md
APIs/API_openFoodFacts/server.js
APIs/API_openFoodFacts/test-api.js
APIs/API_openFoodFacts/vercel.json
Creao_Codebase/biome.json
Creao_Codebase/components.json
Creao_Codebase/config/eslint/base.config.js
Creao_Codebase/config/eslint/eslint.mcp.config.js
Creao_Codebase/config/eslint/eslint.radix.config.js
Creao_Codebase/config/eslint/index.js
Creao_Codebase/config/eslint/rules/mcp-integration.js
Creao_Codebase/config/eslint/rules/radix-ui.js
Creao_Codebase/config/eslint/validate-configs.js
Creao_Codebase/config/hooks/display_hooks.sh
Creao_Codebase/config/hooks/dump/ensure_check_ok.sh
Creao_Codebase/config/hooks/ensure_build_ok.sh
Creao_Codebase/config/hooks/ensure_check_ok.sh
Creao_Codebase/config/hooks/file_tracker.sh
Creao_Codebase/config/hooks/git_diff.sh
Creao_Codebase/config/hooks/resume_prompt_injection.sh
Creao_Codebase/config/hooks/startup_cleanup.sh
Creao_Codebase/config/hooks/startup_prompt_injection.sh
Creao_Codebase/config/hooks/subagent_post_use.sh
Creao_Codebase/config/scripts/startup.sh
Creao_Codebase/config/vite/creao-plugin.mjs
Creao_Codebase/delete-marmite.ts
Creao_Codebase/eslint.config.js
Creao_Codebase/index.html
Creao_Codebase/package.json
Creao_Codebase/public/manifest.json
Creao_Codebase/public/robots.txt
Creao_Codebase/src/components/api/schemas/ImgRecogModel.json
Creao_Codebase/src/components/api/schemas/ImgRecogModel/core/ApiError.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/core/ApiRequestOptions.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/core/ApiResult.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/core/BaseHttpRequest.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/core/CancelablePromise.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/core/FetchHttpRequest.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/core/OpenAPI.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/core/request.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/ImgRecogModel.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/index.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/models/CreaoApiIdHeader.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/models/CreaoApiNameHeader.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/models/CreaoApiPathHeader.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/models/Error.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/models/FoodItem.ts
Creao_Codebase/src/components/api/schemas/ImgRecogModel/services/FoodRecognitionService.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat.json
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/core/ApiError.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/core/ApiRequestOptions.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/core/ApiResult.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/core/BaseHttpRequest.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/core/CancelablePromise.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/core/FetchHttpRequest.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/core/OpenAPI.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/core/request.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/index.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/models/CreaoApiIdHeader.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/models/CreaoApiNameHeader.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/models/CreaoApiPathHeader.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/OpenAIGPTChat.ts
Creao_Codebase/src/components/api/schemas/OpenAIGPTChat/services/DefaultService.ts
[120 more files omitted for size]
```

### Dependencies

- APIs/API_generateRecipes/requirements.txt: requests@==2.31.0
- APIs/API_ImageRecognitionAI/requirements.txt: google-genai, pandas, Pillow, requests, werkzeug
- APIs/API_openFoodFacts/package.json: axios@^1.6.0, cors@^2.8.5, express@^4.18.2, lru-cache@^10.0.0
- Creao_Codebase/package.json: @babel/plugin-syntax-typescript@^7.27.1, @babel/plugin-transform-react-jsx@^7.27.1, @babel/plugin-transform-react-jsx-development@^7.27.1, @biomejs/biome@1.9.4, @fortawesome/fontawesome-svg-core@^7.0.0, @fortawesome/free-brands-svg-icons@^7.0.0, @fortawesome/react-fontawesome@^0.2.3, @hookform/resolvers@^5.0.1, @protobuf-ts/runtime@^2.11.1, @radix-ui/react-accordion@^1.2.11, @radix-ui/react-alert-dialog@^1.1.14, @radix-ui/react-aspect-ratio@^1.1.7, @radix-ui/react-avatar@^1.1.10, @radix-ui/react-checkbox@^1.3.2, @radix-ui/react-collapsible@^1.1.11, @radix-ui/react-context-menu@^2.2.15, @radix-ui/react-dialog@^1.1.14, @radix-ui/react-dropdown-menu@^2.1.15, @radix-ui/react-hover-card@^1.1.14, @radix-ui/react-label@^2.1.7, @radix-ui/react-menubar@^1.1.15, @radix-ui/react-navigation-menu@^1.2.13, @radix-ui/react-popover@^1.1.14, @radix-ui/react-progress@^1.1.7, @radix-ui/react-radio-group@^1.3.7, @radix-ui/react-scroll-area@^1.2.9, @radix-ui/react-select@^2.2.5, @radix-ui/react-separator@^1.1.7, @radix-ui/react-slider@^1.3.5, @radix-ui/react-slot@^1.2.3, @radix-ui/react-switch@^1.2.5, @radix-ui/react-tabs@^1.1.12, @radix-ui/react-toggle@^1.1.9, @radix-ui/react-toggle-group@^1.1.10, @radix-ui/react-tooltip@^1.2.7, @tailwindcss/vite@^4.0.6, @tanstack/react-query@^5.80.3, @tanstack/react-router@^1.114.3, @tanstack/react-router-devtools@^1.114.3, @tanstack/router-plugin@^1.114.3, @testing-library/dom@^10.4.0, @testing-library/jest-dom@^6.6.3, @testing-library/react@^16.2.0, @types/lodash@^4.17.20, @types/react@^19.0.8, @types/react-dom@^19.0.3, @typescript-eslint/eslint-plugin@^8.38.0, @typescript-eslint/parser@^8.38.0, @typescript/native-preview@^7.0.0-dev.20250913.1, @vitejs/plugin-react@^4.3.4, class-variance-authority@^0.7.1, clsx@^2.1.1, cmdk@^1.1.1, date-fns@^3.6.0, embla-carousel-react@^8.6.0, eslint@^9.32.0, eslint-plugin-react@^7.37.5, eslint-plugin-react-hooks@^5.2.0, input-otp@^1.4.2, jsdom@^26.0.0, lodash@^4.17.21, lucide-react@^0.476.0, next-themes@^0.4.6, openapi-fetch@^0.14.0, openapi-react-query@^0.5.0, openapi-typescript@^7.10.1, openapi-typescript-codegen@^0.29.0, react@^19.0.0, react-day-picker@^9.8.0, react-dom@^19.0.0, react-hook-form@^7.57.0, react-resizable-panels@^3.0.2, recharts@^2.15.3, sonner@^2.0.6, tailwind-merge@^3.0.2, tailwindcss@^4.0.6, tailwindcss-animate@^1.0.7, typescript@~5.8.3, vaul@^1.1.2, vite@npm:rolldown-vite@^7.1.9, vite-plugin-babel@^1.3.2, vite-plugin-svgr@^4.5.0, vitest@^3.2.4, web-vitals@^4.2.4, zod@^3.25.50

### Recent commits (newest first)

- Update README with Devpost link and demo
- Update README.md
- Merge pull request #1 from lai-ethan/main
- Update README with team credits and awards
- uploaded image rec API
- Remove multiple files and directories from the Calhacks project, including configuration, assets, and components, while marking the barcode scanner subproject as dirty.
- complete done and dusted
- adding images
- first commit

## Key source files (fetched from GitHub, selected and truncated for size)

### APIs/API_ImageRecognitionAI/SUMMARY.md

```markdown
# Image Recognition API - Summary

## What It Does

This API takes an image file as input and returns a pandas DataFrame (as CSV) containing the edible items detected in the image and their counts.

## Request Format

- **Method**: POST
- **Content-Type**: multipart/form-data  
- **Body**: Form data with an `image` field containing the image file
- **Acceptable image formats**: JPEG, PNG, GIF, etc.

## Response Format

Returns CSV text with two columns:
- `label`: Name of the food item
- `count`: Number of that item detected

Example response:
```
label,count
apple,3
orange,2
banana,1
```

## Example Usage

```bash
curl -X POST https://your-domain.vercel.app/api/image-recognition \
  -F "image=@/path/to/apples_and_oranges.jpg"
```

## How It Works

1. Receives image file via multipart/form-data POST request
2. Processes image using Google Gemini AI (gemini-2.5-flash model)
3. Identifies edible objects and counts them
4. Returns results as a pandas DataFrame in CSV format

## Deployment

Deploy to Vercel using:
```bash
vercel
```

Set the `GOOGLE_API_KEY` environment variable in Vercel dashboard.

```

### APIs/API_ImageRecognitionAI/UPDATED_FEATURES.md

```markdown
# ✅ API Updated with Nutritional Information!

## New Features

Your API now returns comprehensive nutritional information for each food item!

### Updated Response Format

The CSV now includes these columns:
- `label` - Food item name
- `count` - Number of items
- `calories_kcal` - Total calories
- `protein_g` - Protein in grams
- `carbohydrates_g` - Carbohydrates in grams
- `fat_g` - Fat in grams
- `sodium_mg` - Sodium in milligrams

### Example Response

```csv
label,count,calories_kcal,protein_g,carbohydrates_g,fat_g,sodium_mg
apple,10,950,5.0,250.0,3.0,20
orange,5,310,6.0,77.0,1.0,5
```

### How It Works

1. **Identifies food items** in the image
2. **Counts each item** 
3. **Looks up nutritional values** for each food type
4. **Multiplies by count** to get total nutrition
5. **Returns CSV** with all nutritional data

### API Endpoint
```
https://vercel-2esjabz4i-maleekas-projects.vercel.app/api/image-recognition
```

### Test It

```bash
curl -X POST https://vercel-2esjabz4i-maleekas-projects.vercel.app/api/image-recognition \
  --data-binary @your_image.jpg
```

## 🎉 Enhanced!

Your API now provides complete nutritional analysis of food items in images!

```

### Creao_Codebase/package.json

```
{
  "name": "basic_template",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite --port 3000",
    "start": "vite --port 3000",
    "build": "npm run check:safe && vite build",
    "serve": "vite preview",
    "test": "vitest run",
    "check": "tsgo --noEmit && npm run lint:radix -- --fix && npm run format",
    "check:safe": "timeout 20 npm run check || (echo 'Check timed out after 20 seconds' && exit 1)",
    "format": "biome check --write --unsafe",
    "format:quiet": "biome check --write --unsafe --log-level=warn",
    "lint:radix": "grep -l -r '<SelectItem' src | xargs eslint --config config/eslint/eslint.radix.config.js",
    "lint:mcp": "eslint src --config config/eslint/eslint.mcp.config.js",
    "lint:validate": "node config/eslint/validate-configs.js",
    "prepare": "if [ -f ./bin/setup-githooks.sh ]; then ./bin/setup-githooks.sh; fi"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^7.0.0",
    "@fortawesome/free-brands-svg-icons": "^7.0.0",
    "@fortawesome/react-fontawesome": "^0.2.3",
    "@hookform/resolvers": "^5.0.1",
    "@protobuf-ts/runtime": "^2.11.1",
    "@radix-ui/react-accordion": "^1.2.11",
    "@radix-ui/react-alert-dialog": "^1.1.14",
    "@radix-ui/react-aspect-ratio": "^1.1.7",
    "@radix-ui/react-avatar": "^1.1.10",
    "@radix-ui/react-checkbox": "^1.3.2",
    "@radix-ui/react-collapsible": "^1.1.11",
    "@radix-ui/react-context-menu": "^2.2.15",
    "@radix-ui/react-dialog": "^1.1.14",
    "@radix-ui/react-dropdown-menu": "^2.1.15",
    "@radix-ui/react-hover-card": "^1.1.14",
    "@radix-ui/react-label": "^2.1.7",
    "@radix-ui/react-menubar": "^1.1.15",
    "@radix-ui/react-navigation-menu": "^1.2.13",
    "@radix-ui/react-popover": "^1.1.14",
    "@radix-ui/react-progress": "^1.1.7",
    "@radix-ui/react-radio-group": "^1.3.7",
    "@radix-ui/react-scroll-area": "^1.2.9",
    "@radix-ui/react-select": "^2.2.5",
    "@radix-ui/react-separator": "^1.1.7",
    "@radix-ui/react-slider": "^1.3.5",
    "@radix-ui/react-slot": "^1.2.3",
    "@radix-ui/react-switch": "^1.2.5",
    "@radix-ui/react-tabs": "^1.1.12",
    "@radix-ui/react-toggle": "^1.1.9",
    "@radix-ui/react-toggle-group": "^1.1.10",
    "@radix-ui/react-tooltip": "^1.2.7",
    "@tailwindcss/vite": "^4.0.6",
    "@tanstack/react-query": "^5.80.3",
    "@tanstack/react-router": "^1.114.3",
    "@tanstack/react-router-devtools": "^1.114.3",
    "@tanstack/router-plugin": "^1.114.3",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cmdk": "^1.1.1",
    "date-fns": "^3.6.0",
    "embla-carousel-react": "^8.6.0",
    "input-otp": "^1.4.2",
    "lodash": "^4.17.21",
    "lucide-react": "^0.476.0",
    "next-themes": "^0.4.6",
    "openapi-fetch": "^0.14.0",
    "openapi-react-query": "^0.5.0",
    "react": "^19.0.0",
    "react-day-picker": "^9.8.0",
    "react-dom": "^19.0.0",
    "react-hook-form": "^7.57.0",
    "react-resizable-panels": "^3.0.2",
    "recharts": "^2.15.3",
    "sonner": "^2.0.6",
    "tailwind-merge": "^3.0.2",
    "tailwindcss": "^4.0.6",
    "tailwindcss-animate": "^1.0.7",
    "vaul": "^1.1.2",
    "zod": "^3.25.50"
  },
  "devDependencies": {
    "@babel/plugin-syntax-typescript": "^7.27.1",
    "@babel/plugin-transform-react-jsx": "^7.27.1",
    "@babel/plugin-transform-react-jsx-development": "^7.27.1",
    "@biomejs/biome": "1.9.4",
    "@testing-library/dom": "^10.4.0",
    "@testing-library/jest-dom": "^6.6.3",
    "@testing-library/react": "^16.2.0",
    "@types/lodash": "^4.17.20",
    "@types/react": "^19.0.8",
    "@types/react-dom": "^19.0.3",
    "@typescript-eslint/eslint-plugin": "^8.38.0",
    "@typescript-eslint/parser": "^8.38.0",
    "@typescript/native-preview": "^7.0.0-dev.20250913.1",
    "@vitejs/plugin-react": "^4.3.4",
    "eslint": "^9.32.0",
    "eslint-plugin-react": "^7.37.5",
    "eslint-plugin-react-hooks": "^5.2.0",
    "jsdom": "^26.0.0",
    "openapi-typescript": "^7.10.1",
    "openapi-typescript-codegen": "^0.29.0",
    "typescript": "~5.8.3",
    "vite": "npm:rolldown-vite@^7.1.9",
    "vite-plugin-babel": "^1.3.2",
    "vite-plugin-svgr": "^4.5.0",
    "vitest": "^3.2.4",
    "web-vitals": "^4.2.4"
  },
  "overrides": {
    "vite": "npm:rolldown-vite@^7.1.9"
  }
}

```

### APIs/API_generateRecipes/requirements.txt

```
requests==2.31.0

```

### APIs/API_ImageRecognitionAI/requirements.txt

```
google-genai
Pillow
requests
pandas
werkzeug

```

### APIs/API_openFoodFacts/package.json

```
{
  "name": "api-openfoodfacts",
  "version": "1.0.0",
  "description": "A tiny Node.js API that proxies & normalizes Open Food Facts",
  "type": "module",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
    "dev": "node --watch server.js",
    "vercel-build": "echo 'No build step needed'"
  },
  "dependencies": {
    "express": "^4.18.2",
    "axios": "^1.6.0",
    "lru-cache": "^10.0.0",
    "cors": "^2.8.5"
  },
  "keywords": ["api", "openfoodfacts", "proxy", "nutrition"],
  "author": "Your Name",
  "license": "MIT"
}

```

### Creao_Codebase/src/main.tsx

```typescript
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { RouterProvider, createRouter } from "@tanstack/react-router";
import { StrictMode } from "react";
import ReactDOM from "react-dom/client";

// Import the generated route tree
import { routeTree } from "./routeTree.gen.ts";

import reportWebVitals from "./reportWebVitals.ts";
import "./styles.css";

// Import and initialize auth integration
import { initializeAuthIntegration } from "@/lib/auth-integration";

// Global URL parsing and variable setup
interface GlobalAppConfig {
	userId: string | null;
	projectId: string | null;
	taskId: string | null;
	workspaceId: string | null; // Combined projectId-taskId
	uploadFolder: string | null; // Upload folder path
	baseUrl: string | null;
	isValidBuildUrl: boolean;
}

function parseCurrentUrl(): GlobalAppConfig {
	const currentUrl = window.location.href;

	// Pattern: {base_url}/builds/{userId}/{projectId}/{taskId}/dist
	const buildUrlRegex =
		/^(https?:\/\/[^\/]+)\/builds\/([^\/]+)\/([^\/]+)\/([^\/]+)\/dist/;
	const match = currentUrl.match(buildUrlRegex);

	if (match) {
		const [, baseUrl, userId, projectId, taskId] = match;
		const workspaceId = `${projectId}-${taskId}`;
		return {
			userId,
			projectId,
			taskId,
			workspaceId,
			uploadFolder: "resources",
			baseUrl,
			isValidBuildUrl: true,
		};
	}

	// If not a build URL, return nulls
	return {
		userId: null,
		projectId: null,
		taskId: null,
		workspaceId: null,
		uploadFolder: null,
		baseUrl: null,
		isValidBuildUrl: false,
	};
}

// Parse URL and set global variables
const appConfig = parseCurrentUrl();

// Add to window global object for easy access
declare global {
	interface Window {
		APP_CONFIG: GlobalAppConfig;
	}
}

window.APP_CONFIG = appConfig;

// Also export for module imports
export const APP_CONFIG = appConfig;

// Log the parsed configuration
console.log("App Configuration:", {
	userId: appConfig.userId,
	projectId: appConfig.projectId,
	taskId: appConfig.taskId,
	workspaceId: appConfig.workspaceId,
	uploadFolder: appConfig.uploadFolder,
	baseUrl: appConfig.baseUrl,
	isValidBuildUrl: appConfig.isValidBuildUrl,
	currentUrl: window.location.href,
});

// Initialize auth integration automatically when app starts
initializeAuthIntegration();

// Create a QueryClient instance
const queryClient = new QueryClient({
	defaultOptions: {
		queries: {
			staleTime: 5 * 60 * 1000, // 5 minutes
			gcTime: 10 * 60 * 1000, // 10 minutes (previously cacheTime)
			retry: 1,
			refetchOnWindowFocus: false,
		},
	},
});

// Create a new router instance
const router = createRouter({
	routeTree,
	context: {},
	defaultPreload: "intent",
	scrollRestoration: true,
	defaultStructuralSharing: true,
	defaultPreloadStaleTime: 0,
	basepath: import.meta.env.TENANT_ID ? `/${import.meta.env.TENANT_ID}` : "/",
});

// Register the router instance for type safety
declare module "@tanstack/react-router" {
	interface Register {
		router: typeof router;
	}
}

// Render the app
const rootElement = document.getElementById("app");
if (rootElement && !rootElement.innerHTML) {
	const root = ReactDOM.createRoot(rootElement);
	root.render(
		<StrictMode>
			<QueryClientProvider client={queryClient}>
				<RouterProvider router={router} />
			</QueryClientProvider>
		</StrictMode>,
	);
}

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

```

### APIs/API_openFoodFacts/server.js

```javascript
// server.js
// A tiny Node.js API that proxies & normalizes Open Food Facts,
// with CORS allowlist, caching, and consistent error responses.
//
// Usage:
//   npm i express axios lru-cache cors
//   node server.js
//
// Env vars (optional):
//   PORT=8080
//   OFF_BASE=https://world.openfoodfacts.org
//   USER_AGENT="my-app/1.0 (you@domain.com)"
//   ALLOWED_ORIGINS="https://yourapp.creao.ai,http://localhost:5173"

import express from "express";
import axios from "axios";
import { LRUCache } from "lru-cache";
import cors from "cors";

const app = express();
app.disable("x-powered-by");

// ---------- Config ----------
const PORT = process.env.PORT || 8080;
const OFF_BASE = process.env.OFF_BASE || "https://world.openfoodfacts.org";
const USER_AGENT = process.env.USER_AGENT || "off-proxy/1.0 (contact@example.com)";
const ALLOWED = (process.env.ALLOWED_ORIGINS ||
  "https://yourapp.creao.ai,https://yourdomain.com,https://dede3phc22dgx.cloudfront.net,https://*.creao.ai,http://localhost:5173,http://localhost:5174")
  .split(",")
  .map(s => s.trim())
  .filter(Boolean);

// HTTP client
const http = axios.create({
  baseURL: OFF_BASE,
  headers: { "User-Agent": USER_AGENT, "Accept": "application/json" },
  timeout: 8000,
});

// Simple in-memory cache
const cache = new LRUCache({
  max: 1000,
  ttl: 1000 * 60 * 10, // 10 minutes
});

// ---------- CORS (allowlist) ----------
app.use(cors({
  origin: function(origin, callback) {
    // Allow requests with no origin (like mobile apps or curl requests)
    if (!origin) return callback(null, true);
    
    // Check if origin is in allowed list
    if (ALLOWED.includes(origin)) {
      return callback(null, true);
    }
    
    // Allow all creao.ai subdomains
    if (origin.includes('creao.ai') || origin.includes('cloudfront.net')) {
      return callback(null, true);
    }
    
    // For development, allow localhost
    if (origin.includes('localhost') || origin.includes('127.0.0.1')) {
      return callback(null, true);
    }
    
    console.log('CORS blocked origin:', origin);
    return callback(new Error("CORS: Origin not allowed"));
  },
  credentials: true,
  methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
  allowedHeaders: ["Content-Type", "Authorization", "X-Requested-With", "Accept", "Origin"],
  exposedHeaders: ["Content-Length", "ETag"],
  maxAge: 86400,
}));
app.options("*", cors());

// ---------- Middleware ----------
app.use(express.json());

// ---------- Helpers ----------
function normalizeProduct(p) {
  if (!p) return null;
  const frontImage = p.selected_images?.front?.display;
  const imageUrl = frontImage ? Object.values(frontImage)[0] : null;
  
  // Extract nutrition data
  const nutriments = p.nutriments || {};
  
  return {
    code: p.code ?? null,
    product_name_en: p.product_name_en ?? null,
    generic_name_en: p.generic_name_en ?? null,
    quantity: p.quantity ?? null,
    product_quantity: p.product_quantity ?? null,
    product_quantity_unit: p.product_quantity_unit ?? null,
    serving_size: p.serving_size ?? null,
    serving_quantity: p.serving_quantity ?? null,
    serving_quantity_unit: p.serving_quantity_unit ?? null,
    ingredients: p.ingredients ?? null,
    ingredients_text_en: p.ingredients_text_en ?? null,
    ingredients_analysis_tags: p.ingredients_analysis_tags ?? null,
    allergens_tags: p.allergens_tags ?? null,
    image_url: imageUrl,
    brands: p.brands ?? null,
    categories: p.categories ?? null,
    // Nutrition data
    calories: nutriments["energy-kcal"] ?? null,
    calories_unit: nutriments["energy-kcal_unit"] ?? "kcal",
    protein: nutriments.proteins ?? null,
    protein_unit: nutriments.proteins_unit ?? "g",
    carbohydrates: nutriments.carbohydrates ?? null,
    carbohydrates_unit: nutriments.carbohydrates_unit ?? "g",
    fiber: nutriments.fiber ?? null,
    fiber_unit: nutriments.fiber_unit ?? "g",
    sugars: nutriments.sugars ?? null,
    sugars_unit: nutriments.sugars_unit ?? "g",
    fat: nutriments.fat ?? null,
    fat_unit: nutriments.fat_unit ?? "g",
    sodium: nutriments.sodium ?? null,
    sodium_unit: nutriments.sodium_unit ?? "g",
    source: "openfoodfacts",
  };
}

function problem({ status = 500, title = "Internal Server Error", detail, instance }) {
  return {
    type: "about:blank",
    title,
    status,
    detail: detail || undefined,
    instance: instance || undefined,
  };
}

// ---------- Routes ----------

// Health check
app.get("/v1/health", (req, res) => {
  res.json({ status: "ok", upstream: OFF_BASE });
});

// Get a single product by barcode
app.get("/v1/products/:barcode", async (req, res, next) => {
  try {
    const { barcode } = req.params;
    const key = `prod:${barcode}`;
    if (cache.has(key)) return res.json(cache.get(key));

    const fields = [
      "code",
      "product_name_en",
      "generic_name_en",
      "quantity",
      "product_quantity",
      "product_quantity_unit",
      "serving_size",
      "serving_quantity",
      "serving_quantity_unit",
      "ingredients",
      "ingredients_text_en",
      "ingredients_analysis_tags",
      "allergens_tags",
      "selected_images",
      "brands",
      "categories",
      "nutriments",
    ].join(",");

    const { data } = await http.get(`/api/v2/product/${encodeURIComponent(barcode)}.json`, {
      params: { fields },
    });

    if (!data || !data.product) {
      return res.status(404).json(problem({
        status: 404,
        title: "Not Found",
        detail: `Barcode ${barcode} not found`,
        instance: req.originalUrl,
      }));
    }

    const normalized = normalizeProduct(data.product);
    cache.set(key, normalized);
    res.json(normalized);
  } catch (err) {
    next(err);
  }
});

// Batch lookup by codes (?codes=comma,separated)
app.get("/v1/products", async (req, res, next) => {
  try {
    const codes = String(req.query.codes || "").trim();
    if (!codes) {
      return res.status(400).json(problem({
        status: 400,
  
[truncated — 1930 more characters]
```

### APIs/API_generateRecipes/api/index.py

```python
from http.server import BaseHTTPRequestHandler
import json


class handler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.send_header('Content-type', 'application/json')
        self.end_headers()
        self.wfile.write(json.dumps({'message': 'Hello from Python!'}).encode())
        return


```

### Creao_Codebase/config/eslint/index.js

```javascript
/**
 * ESLint Configuration Index
 * 
 * Centralized configuration management for different linting contexts.
 * This provides a single entry point for all ESLint configurations.
 */

import baseConfig from './base.config.js';
import mcpConfig from './eslint.mcp.config.js';
import radixConfig from './eslint.radix.config.js';
import radixRules from './rules/radix-ui.js';

export { baseConfig, mcpConfig, radixConfig };

// Default export combines base configuration with Radix validation
export default [
  ...baseConfig,
  {
    files: ['**/*.{ts,tsx}'],
    plugins: {
      'radix-custom': {
        rules: radixRules
      }
    },
    rules: {
      'radix-custom/no-empty-select-item': 'error'
    }
  }
]; 
```

[189 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]