Skip to content

Giathi-Daniel/RecipeAI---Snap-Scan-Cook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

175 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍽️ RecipeAI β€” Snap, Scan & Cook

Upload a food photo or paste any recipe text. AI structures it, analyzes it, and makes it interactive.

Next.js FastAPI Supabase Vercel Render License


What is RecipeAI?

RecipeAI is a full-stack AI-powered recipe assistant that lets users:

  • Upload a food photo β€” AI identifies the dish and fetches a structured recipe
  • Paste any recipe text β€” even messy, emoji-heavy WhatsApp-style formats β€” and AI parses and structures it automatically
  • Scale servings β€” ingredient quantities adjust in real time
  • Localize recipes β€” adapt dishes to local/regional ingredients (e.g. a Kenyan twist on a European dish)
  • Substitute ingredients β€” "I don't have thyme, what can I use?"
  • Get nutritional info β€” calories, macros, and dietary flags per serving

Tech Stack

Layer Technology
Frontend Next.js 15 (App Router, Tailwind CSS)
Backend / API FastAPI (Python)
AI β€” Text & Reasoning Google Gemini API (free tier)
AI β€” Image Recognition Google Cloud Vision API (free tier)
Auth Supabase Auth
Database Supabase (PostgreSQL)
Frontend Deployment Vercel
Backend Deployment Render

Project Structure

recipeai/
β”œβ”€β”€ frontend/                  # Next.js app
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ (auth)/            # Login / signup pages
β”‚   β”‚   β”œβ”€β”€ dashboard/         # User saved recipes
β”‚   β”‚   β”œβ”€β”€ recipe/[id]/       # Single recipe view
β”‚   β”‚   └── upload/            # Upload & paste flow
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ RecipeCard.tsx
β”‚   β”‚   β”œβ”€β”€ IngredientList.tsx
β”‚   β”‚   β”œβ”€β”€ ServingScaler.tsx
β”‚   β”‚   └── NutritionBadge.tsx
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ supabase.ts        # Supabase client
β”‚   β”‚   └── api.ts             # FastAPI client helpers
β”‚   └── public/
β”‚
β”œβ”€β”€ backend/                   # FastAPI app
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ routers/
β”‚   β”‚   β”œβ”€β”€ recipes.py         # Parse, structure, save
β”‚   β”‚   β”œβ”€β”€ vision.py          # Image recognition
β”‚   β”‚   β”œβ”€β”€ ai.py              # Gemini AI calls
β”‚   β”‚   └── auth.py            # Supabase JWT verification
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── recipe.py          # Pydantic models
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ gemini_service.py
β”‚   β”‚   └── vision_service.py
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ supabase/
β”‚   └── migrations/            # DB schema SQL files
β”‚
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
└── README.md

Getting Started

Prerequisites


1. Clone the repo

git clone https://github.com/your-username/recipeai.git
cd recipeai

2. Set up environment variables

Copy the example env file and fill in your keys:

cp .env.example .env
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

# Google Gemini
GEMINI_API_KEY=your_gemini_api_key

# Google Cloud Vision
GOOGLE_APPLICATION_CREDENTIALS=path/to/your/credentials.json

# FastAPI
BACKEND_URL=http://localhost:8000

3. Frontend setup

cd frontend
npm install
npm run dev

Frontend runs at http://localhost:3000


4. Backend setup

cd backend
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload

Backend runs at http://localhost:8000

API docs available at http://localhost:8000/docs


5. Supabase DB setup

Run the migration in supabase/migrations/ via the Supabase dashboard SQL editor, or use the Supabase CLI:

supabase db push

Database Schema (Supabase)

-- Users handled by Supabase Auth

create table recipes (
  id uuid primary key default gen_random_uuid(),
  user_id uuid references auth.users(id) on delete cascade,
  title text not null,
  description text,
  image_url text,
  source_text text,             -- original pasted/uploaded input
  structured_data jsonb,        -- parsed ingredients, steps, etc.
  nutrition jsonb,
  servings integer default 4,
  created_at timestamptz default now()
);

create table saved_recipes (
  id uuid primary key default gen_random_uuid(),
  user_id uuid references auth.users(id) on delete cascade,
  recipe_id uuid references recipes(id) on delete cascade,
  created_at timestamptz default now()
);

API Endpoints

Method Endpoint Description
POST /api/recipes/parse Parse raw recipe text using Gemini AI
POST /api/vision/identify Identify dish from uploaded image
GET /api/recipes/{id} Fetch a single saved recipe
POST /api/recipes/save Save structured recipe to Supabase
GET /api/recipes/user/{user_id} Get all recipes for a user
POST /api/recipes/substitute Get ingredient substitutions
POST /api/recipes/localize Localize recipe to a region

AI Features In Detail

Recipe Parser (Gemini)

Sends raw text (including emojis, informal formatting) to Gemini with a structured prompt. Returns clean JSON with title, ingredients[], steps[], servings, and tags.

Image Recognition (Google Vision)

Uploads image to Vision API β†’ gets label annotations β†’ uses top labels as search terms β†’ Gemini generates or fetches a matching recipe.

Ingredient Substitution (Gemini)

Sends ingredient + dish context β†’ returns 2–3 substitution options with notes on flavor impact.

Localization (Gemini)

Sends full recipe + target region β†’ returns adapted recipe with locally available ingredient equivalents.


Deployment

Frontend β†’ Vercel

# Push to GitHub, connect repo on vercel.com
# Add all NEXT_PUBLIC_* env vars in Vercel dashboard

Backend β†’ Render

# Push backend/ to GitHub
# Create a new Web Service on render.com
# Build command: pip install -r requirements.txt
# Start command: uvicorn main:app --host 0.0.0.0 --port 10000
# Add all env vars in Render dashboard

Screenshots

Text Parser - Upload Recipe Text

Text-Parser

Parsed Recipe Preview

Parsed-Text

Complete Recipe View

Recipe-Review

Landing Page (Desktop)

Landing-Page-Main

Mobile View

Mobile-View


Contributing

Pull requests are welcome. For major changes, please open an issue first.


License

MIT


Author

Built by Daniel Giathi β€” a Software Engineer passionate about building AI-powered tools for everyday life.

LinkedIn GitHub