Inspiration

The idea behind Recipe Retriever was to create an automated and structured way to extract recipes from websites and store them in a database. Many recipes online are unstructured, hidden inside long blog posts and images, or formatted inconsistently. By using web scraping and AI, we can cleanly extract, structure, and store recipe data for easy retrieval and use.

What it does

Users can input a URL, and the API will automatically process and store the recipe in a clean and organized way.

How we built it

Tech Stack: FastAPI → Backend API PostgreSQL → Database for storing recipes BeautifulSoup → Web scraping for extracting text OpenAI API → AI-powered text processing Psycopg2 → PostgreSQL database connection Uvicorn → ASGI server for running FastAPI

Step-by-Step Build Process:

  1. Set up FastAPI and defined API routes.
  2. Implemented web scraping using BeautifulSoup.
  3. Integrated OpenAI API to extract structured recipe data.
  4. Connected FastAPI to PostgreSQL using psycopg2.
  5. Created endpoints for CRUD operations (Create, Read, Update, Delete).
  6. Tested API requests using Swagger UI (/docs). ## Challenges we ran into Extracting only useful recipe data – Many recipe websites have ads, extra text, and unrelated content. We had to fine-tune our scraping and AI prompt to only extract ingredients, instructions, and the recipe name.

Handling different website formats – No two recipe sites are the same! Some use structured HTML, while others have text buried inside multiple

tags. We had to adapt our scraper for different cases.

Database structure & storage format – PostgreSQL doesn’t natively store lists, so we had to convert ingredients & instructions into array-friendly formats before saving them.

Ensuring API stability – Some websites block scraping, so we had to implement user-agent headers to make requests appear as a real browser.

Accomplishments that we're proud of

Successfully built a working API that can scrape, process, and store recipes. Integrated AI-powered text processing to improve data quality. Created a fully functional database to store structured recipe data. Developed clean, organized API endpoints for easy access and use.

What we learned

How to efficiently scrape web data while avoiding unnecessary content. Using AI (OpenAI API) to structure messy, unformatted text into JSON. Connecting FastAPI to PostgreSQL and handling structured data storage. Implementing robust API error handling to prevent failures during scraping or database interactions.

What's next for Recipe Retriever

Add user authentication → Allow users to save & manage personal recipes. Expand AI capabilities → Improve recipe extraction for more website types. Create a front-end UI → A simple web or mobile app for users to interact with the API easily. Enable recipe categorization → Automatically sort recipes by cuisine, difficulty, or ingredients. Improve database performance → Optimize queries for faster recipe retrieval.

Built With

Share this project:

Updates