PizzaPizza

Infinite Meals

Infinite Meals is a recipe search engine that uses OpenAI's GPT-3.5-Turbo-1106 Model through Open AI API to generate recipes for any given Food. It's a simple and easy way to find new recipes and get inspiration for your next meal.

How to Get Recipe?

You can find Recipes in multiple ways

    1. You can search for any recipe by going on your dashboard and searching for a recipe.

    2. You can find recipes by going to the categories page and selecting a category that you want to find recipes for.

    3. You can find recipes by going to the all recipes page and selecting a recipe that you'd like.

How does it Work?

Multiple Things Happen before the searched Recipe is returned to you.

  • 1. The recipe is Searched for in the Redis Cache against [when recipe is searched for the first time, it is cached]
  • 2. If unavailable in cache, it's looked for in the database.
  • 3. If the recipe is still unavailable, Text - Davinci - 003 is used to get the recipe for that item.
  • 4. The response from Text - Davinci - 003 is displayed to the user at this point of time.
  • 5. The response from the Database is then added into the Database and Cached for future use.
  • 6. Meanwhile, When Text - Davinci - 003 is used for fetching the recipe, the image is being looked for using Google Images Search from SERP API. The image fetched from the API is added to Cloudinary.
  • 7. The image added is displayed while the Image URL is added into the recipe Database and cache for future use.

Tech That was Used:

    Upstash - Redis Caching & Rate Limiting
    Open AI API - AI Generated Recipes
    SERP API - Images
    Cloudinary - Image Storage
    Planet Scale - ServerLess MySQL DB
    Prisma - ORM
    Next Auth- Auth
    Next.js 13.4.9 - Project
    Vercel - Deployment

Routes Reference (v2):

    POST /api/v2/recipes/database

    Looks for the recipe searched in Redis Cache and Main Database

    POST /api/v2/recipes/completion

    Uses Open AI API to generate recipes based on the search query

    POST /api/v2/recipes/uid

    Fetches Recipe based on the UID

    POST /api/v2/recipes/update-recipe-by-ai

    Adds the recipe generated by AI to the database and cache

    POST /api/v2/images/database

    Searches for the image in the cache and database for a recipe

    POST /api/v2/images/search

    Uses Serp API to search for images based on the search query using Google Images Search

    POST /api/v2/images/completion

    [unused] Uses DALL - E to create images for food Items based on the search query

    POST /api/v2/images/update-image-db

    Uploads Images to Cloudinary and updates the database inserting the imgURL, also caches the imgURL

    POST /api/v2/tags/create

    Creates A new Tag if not already present in list of Tags in Database.

    GET /api/v2/tags/get-tags

    Gets the list of all tags present in the database

    POST /api/v2/tags/recipes

    Gets the list of all recipes present in the database with the tag

    POST /api/v2/tags/recipes/completion

    Uses Open AI API to generate a recipe for the given tag

Bon Appetit!

Infinite
Meals

Crafted with by 8rxn

Infinite
Meals