This product allows users to save their favorite recipes across multiple websites all in one place.
Grandma used to have a bin full of recipes written on index cards from her favorite books and magazines. That was messy, easy-to-lose, and the cards decayed, especially if you spilt your pasta water on it while following along. The internet changed things, and we can digitally save recipes! However, many websites only save recipes from their website, and don't allow you to import recipes from other locations.
Enter Mon Recette. You can save and edit recipes from multiple websites. Grandma doesn't need to worry about losing or ruining her index cards, and you don't need to worry about having to visit multiple places to find that one recipe you are looking for, but couldn't remember if it belonged to this blog or that blog or allrecipes or foodnetwork, etc.
OS X & Linux: This project runs on Rails 7.0.8.
Fork and clone this repository, which is the front-end of our application.
Fork and clone this repository to access our back-end.
Windows:
This product is not compatible with Windows.
This application uses a free and unlimited api called TheMealDB. You don't need to sign up for a key, or use a key at all! It also utilizes caching and background workers; caching to make repeated search for terms or recipes quicker (memoization) and workers to handle actions that won't effect the main thread of the application.
There are plenty of great websites with amazing recipes that will turn any evening into a memory that will last a lifetime. That downside is that those recipes are saved in multiple locations, not in a single place. With Mon Recette, you can import and save recipes from:
- TheMealDB
- Food Network
- All Recipes
- A Wicked Whisk
- Taste of Home
We hope to add more complete functionality by incorporating AI to webscrape a more robust collection of websites. Stay tuned!
Mon Recette will save all your recipes in one place.
Users can create an account using their email. Once an account has been made, the user will be able to login and see their User Dashboard.
Functionality here is very simple and straightforward. Either go to your saved recipes list, or search for a food item such as chicken (to find recipes for chicken) or paste in the url from a recipe you found at a different website.
If searching for food terms, it will return a list of recipes with images you can browse.
If pasting a url, it will return that recipe with the ingredients list and instructions side-by-side.
When searching for recipes or pasting a recipe link, there will be a button to save the recipe. It will then show up in your "Saved Recipes" list which can be accessed in the navbar.
Feel like the recipe needs tweaking? We will be adding the ability to edit the recipe soon!
Download both our front end and back end applications.
Start the server on the back end application by typing the following in the terminal.
rails s
NOTE: The back-end application should be running on PORT 5000, while the front-end application should be running on PORT 3000.
Run the following code in your terminal to install the gems required to use this application:
bundle install
Check to make sure all the tests are passing by running the following code in your terminal:
bundle exec rspec
Frontend is deployed with vercel
Backend is deployed with heroku (note: there is nothing interesting to see here, as be is purely a microservice for frontend).
We used the Nokogiri gem to webscrape recipe data.
Click to read more about Nokogiri.
Example of bootstrap code
def conn(url)
Faraday.get(url)
end
def scrape(url)
response = conn(url)
Nokogiri::HTML(response.body)
end
end
Our application includes extensive testing using the Capybara gem to simulate user input and interaction.
This application also uses the Launchy Gem to view pages in the browser without needing to start the server.
The Shoulda Matchers Gem is used for one-liner testing of models.
The Orderly Gem is used to check the order in which items appear on the pages for our application.
The SimpleCov Gem provides test coverage analysis for our application.
The back end handles API calls to the TomTom API as well as accepts post requests from the user for location moods. It simulates API calls using the WebMock gem and the VCR gem.
Both use the Pry gem and RSpec Rails within the testing environment for unit and feature testing.
- Search recipes.
Endpoint:
/api/v1/searches
Description: Fetch recipes using search terms such as "chicken." information. Example Request:
http://127.0.0.1:3000/api/v1/searches?term=chicken
Response will be returned in the following JSON contract format:
{
"data": {
"id": null,
"type": "meal",
"attributes": {
"recipes": [
{
"name": "String",
"instructions": "String",
"image_url": null,
"ingredients": [
"String"]
}]
}
}
}
The same endpoint is used to find recipes from other websites. Here is an example:
http://127.0.0.1:5000/api/v1/searches?term=https://www.awickedwhisk.com/homemade-chicken-ravioli-recipe-3/
The JSON response will be the same.
- Save recipes and view them
Endpoint:
/api/v1/recipes
Description: Fetch user saved recipes. Example Request:
id_params = {
user_id: user.id
}
get "/api/v1/recipes", params: id_params
Response will be returned in the following JSON contract format:
{:data=>
{:id=>"null",
:type=>"user_recipes",
:attributes=>
{:user_id=> integer,
:recipes=>[{:name=>"string", :ingredients=>["string", "string"], :instructions=>["string"]}
]
}
}
}
- Most recent search
Endpoint:
/api/v1/recent_search
Description: Fetch most recent search term. Example Request:
get "/api/v1/recent_search"
Response will be returned in the following JSON contract format:
{
"message": "Most recent search: chicken"
}