SnapDish AI is an innovative AI-powered web application that transforms the way users interact with food. By leveraging advanced computer vision and AI technologies, SnapDish AI allows users to identify dishes from images and discover detailed recipes, making cooking more accessible and enjoyable for everyone.
- Features
- Tech Stack
- Getting Started
- Project Structure
- Database Schema
- Key Components
- AI Integration
- Environment Variables
- Development Roadmap
- Milestones
- Contributing
- License
- AI-Powered Dish Recognition: Upload or capture images of dishes, and the AI identifies them to suggest relevant recipes.
- Multi-Model AI Processing: Uses a cascade of AI models (Gemini, TensorFlow.js, YOLO) for accurate food recognition.
- Detailed Recipe Generation: Get comprehensive recipes with ingredients, step-by-step instructions, and cooking tips.
- User Authentication: Secure login and registration system using Supabase authentication.
- Recipe Saving: Save favorite recipes to your profile for easy access later.
- Responsive Design: User-friendly interface built with Next.js and Tailwind CSS that works on all devices.
- Dark/Light Mode: Toggle between dark and light themes for comfortable viewing in any environment.
- Frontend: Next.js 14, React, TailwindCSS, shadcn/ui
- Backend: Next.js Server Components and Server Actions
- Authentication: Supabase Auth
- Database: Supabase PostgreSQL
- Storage: Supabase Storage
- AI & Machine Learning:
- Google Gemini Pro Vision API
- TensorFlow.js
- YOLO
- Deployment: Vercel
- Node.js >= 18.x
- npm or yarn
- Supabase account
- Google Gemini API key
git clone https://github.com/yourusername/snapdish-ai.git
cd snapdish-ai
npm install
# or
yarn installCreate a .env.local file:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# AI API Keys
GEMINI_API_KEY=your_gemini_api_key
# Application Settings
NEXT_PUBLIC_APP_URL=http://localhost:3000Use the following SQL in Supabase SQL editor:
CREATE TABLE IF NOT EXISTS profiles (
id UUID PRIMARY KEY REFERENCES auth.users(id) ON DELETE CASCADE,
username TEXT UNIQUE,
full_name TEXT,
avatar_url TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS recipes (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
description TEXT,
image_url TEXT,
ingredients JSONB NOT NULL,
instructions JSONB NOT NULL,
cooking_time TEXT,
difficulty TEXT,
servings INTEGER,
cuisine TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS user_recipes (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
recipe_id TEXT NOT NULL REFERENCES recipes(id) ON DELETE CASCADE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
UNIQUE(user_id, recipe_id)
);
CREATE TABLE IF NOT EXISTS dish_identifications (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID REFERENCES auth.users(id) ON DELETE SET NULL,
image_url TEXT,
identified_dish TEXT,
recipe_id TEXT REFERENCES recipes(id) ON DELETE SET NULL,
confidence_score FLOAT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);npm run dev
# or
yarn devβββ app/
β βββ about/
β βββ api/
β βββ auth/
β βββ contact/
β βββ features/
β βββ profile/
β βββ recipe/
β βββ signin/
β βββ actions.ts
β βββ globals.css
β βββ layout.tsx
β βββ page.tsx
βββ components/
β βββ auth/
β βββ image-uploader.tsx
β βββ profile/
β βββ recipe/
β βββ theme-provider.tsx
β βββ theme-toggle.tsx
β βββ ui/
βββ lib/
β βββ ai/
β β βββ gemini-vision.ts
β β βββ groq-vision.ts
β β βββ recipe-generation.ts
β β βββ tensorflow-recognition.ts
β β βββ yolo-detection.ts
β βββ api/
β β βββ recipe-service.ts
β βββ supabase/
β β βββ client.ts
β β βββ database.types.ts
β β βββ server.ts
β β βββ storage-service.ts
β βββ utils/
β βββ image-processing.ts
βββ public/
β βββ images/
βββ utils/
β βββ supabase/
β βββ middleware.ts
βββ middleware.ts
βββ next.config.js
βββ package.json
βββ tailwind.config.ts
βββ tsconfig.json| Column | Type | Description |
|---|---|---|
| id | UUID | PK, references auth.users(id) |
| username | TEXT | Unique username |
| full_name | TEXT | User's full name |
| avatar_url | TEXT | URL to user's avatar image |
| created_at | TIMESTAMP | Creation timestamp |
| updated_at | TIMESTAMP | Last update timestamp |
| Column | Type | Description |
|---|---|---|
| id | TEXT | Primary key |
| name | TEXT | Recipe name |
| description | TEXT | Recipe description |
| image_url | TEXT | Image URL |
| ingredients | JSONB | List of ingredients |
| instructions | JSONB | List of instructions |
| cooking_time | TEXT | Cooking time |
| difficulty | TEXT | Difficulty level |
| servings | INTEGER | Servings |
| cuisine | TEXT | Cuisine type |
| created_at | TIMESTAMP | Creation timestamp |
| updated_at | TIMESTAMP | Last update timestamp |
| Column | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| user_id | UUID | References auth.users(id) |
| recipe_id | TEXT | References recipes(id) |
| created_at | TIMESTAMP | Creation timestamp |
| Column | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| user_id | UUID | References auth.users(id) |
| image_url | TEXT | URL to uploaded image |
| identified_dish | TEXT | Name of identified dish |
| recipe_id | TEXT | References recipes(id) |
| confidence_score | FLOAT | AI confidence score |
| created_at | TIMESTAMP | Timestamp |
image-uploader.tsx: Handles image capture/upload.theme-toggle.tsx: Switch between light/dark mode.gemini-vision.ts: Integration with Google Gemini.recipe-generation.ts: Builds a recipe based on identified dish.supabase/client.ts: Client-side Supabase setup.
- Primary: Gemini Vision Pro API
- Fallback 1: TensorFlow.js (food models)
- Fallback 2: YOLOv5 object detection
Configured in .env.local:
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
GEMINI_API_KEY=
NEXT_PUBLIC_APP_URL=http://localhost:3000- Image upload and AI processing
- Recipe generation and storage
- Profile page with saved recipes
- AI model confidence comparison
- Meal planning feature
- Multilingual recipe generation
- v1.0 β Basic functionality (AI + Recipes + Auth)
- v2.0 β User dashboard, saved recipes, dark mode
- v3.0 β Voice-based interaction (future)
Contributions are welcome! Please fork the repository and create a PR.
This project is licensed under the MIT License.
For more information and updates, visit our official website or follow us on Twitter.
