Coder Social home page Coder Social logo

abhiek187 / ez-recipes-web Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 17.58 MB

Easy recipes finder Angular app

Home Page: https://ez-recipes-web.onrender.com/

License: MIT License

JavaScript 0.89% TypeScript 81.99% HTML 11.60% SCSS 5.29% Dockerfile 0.23%
angular recipes docker render spoonacular-api angular-material indexeddb localstorage

ez-recipes-web's Introduction

EZ Recipes Web App

Node.js CI CodeQL

Home screen Jambalaya Stew, recipe heading Jambalaya Stew, instructions Searching for pasta with chicken

Overview

Cooking food at home is an essential skill for anyone looking to save money and eat healthily. However, learning how to cook can be daunting, since there are so many recipes to choose from. Even when meal prepping, knowing what ingredients to buy, what equipment is required, and the order of steps to make the meal can be hard to remember for many different recipes. Plus, during busy days, it's nice to be able to cook up something quick and tasty.

Introducing EZ Recipes, an app that lets chefs find low-effort recipes that can be made in under an hour, use common kitchen ingredients, and can produce multiple servings. On one page, chefs can view what the recipe looks like, its nutritional qualities, the total cooking time, all the ingredients needed, and step-by-step instructions showing what ingredients and equipment are required per step. Each recipe can be shared so other chefs can learn how to make the same recipes.

Chefs can either find a random recipe or search for one using various filters, including by name, dietary restrictions, spice level, and meal type.

The app features a glossary to easily look up the meaning of common terms found in recipes. This will better assist newer chefs in learning how to cook, prep certain ingredients, and use certain kitchen tools. Think How to Stock, but for cooking food instead of managing finances.

The site can be visited at https://ez-recipes-web.onrender.com/.

Features

  • Single-Page Web Application created using Angular
  • TypeScript for type safety and SCSS for enhanced CSS syntax
  • Material Design UI
  • Responsive and accessible web design
  • Best practices for Progressive Web Apps
  • Search Engine Optimization (SEO)
  • REST APIs to a custom server, which fetches recipe information from spoonacular and MongoDB
  • Offline data storage using localStorage and IndexedDB
  • Automated testing and deployment using CI/CD pipelines in GitHub Actions
  • Containerized development and production environments using Docker
  • Mermaid to write diagrams as code

Pipeline Diagrams

NPM CI

flowchart LR

A(Checkout repository) -->|18.x, 20.x| B(Install Node.js)
B --> C(Install dependencies:\nnpm ci)
C --> D(Lint app:\nnpm run lint)
D --> E(Build app:\nnpm run build --if-present)
E --> F(Run Angular tests:\nnpm test)
Loading

CodeQL

flowchart LR

A(Checkout repository) -->|JavaScript| B(Initialize CodeQL)
B --> C(Build code)
C --> D(Perform CodeQL analysis)
Loading

Deployment

flowchart LR

A(Merge PR to main) --> B(Auto-Deploy to Render)

subgraph B [Auto-Deploy to Render]
direction TB
C(Install dependencies:\nnpm install) --> D(Build web app:\nnpm run build)
D --> E(Use Brotli compression)
E --> F(Serve website over HTTPS on a global CDN)
F --> G(Invalidate CDN cache)
end
Loading

Source: Render

Installing Locally

  1. Clone this repo.
  2. Run npm install to install all the dependencies.
  3. Run npm start for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.
  4. In a separate terminal, follow the steps to set up the EZ Recipes server, so the recipes can be fetched locally.
  5. When done, press Ctrl-C to stop the server.

Testing

Run npm test to run the unit tests using Karma.

Linting

Run npm run lint to lint the entire app using ESLint.

Build

Run npm run build to build the project. The build artifacts will be stored in the dist/ directory. Then run python3 -m http.server -d dist/ez-recipes/ PORT to serve the page over a simple HTTP server. (By default, PORT is 8000.)

Further Help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

Docker

Development

  1. Build the Docker image: docker build . -t TAG_NAME
  2. Run the image in a container: docker run --rm -p 4200:4200 -d TAG_NAME
  3. Open localhost:4200

Production

  1. Build the Docker image: docker build . -t TAG_NAME -f Dockerfile.prod
  2. Run the image in a container: docker run --rm -p 4200:80 -d TAG_NAME
  3. Open localhost:4200

Run docker kill <container id> to shut down the image when done. The container ID can be found using docker ps.

Future Updates

EZ Recipes is continuously improving! More features will come in the future to enhance the cooking experience, including (but not limited to):

  • Accounts so chefs can sync their favorite recipes across all their devices
  • The ability to favorite, rate, and view the popularity of recipes
  • An enhanced home page showing recently viewed recipes and any recommended/popular recipes
  • Showing additional recipe information, such as allergens

Related Repos

ez-recipes-web's People

Contributors

abhiek187 avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

ez-recipes-web's Issues

Gracefully handle recipes that don't have any fiber measurement

With recipes stored in MongoDB, I was finally able to analyze recipes that only have 8 nutrients. This would explain why some of the UI tests failed due to fiber missing on the nutrition labels.

Query

{ "nutrients.8": { $exists: false } }

Sample recipe IDs: 665485, 643851, 633224, 157101

This goes for all platforms, even the server, and includes all unit/UI tests. Changes may or may not be necessary depending on how each platform handles this edge case.

As a bonus, see how well each platform handles recipes with many steps, such as 644227.

Save recipes offline

A use case would be:

As a user, I want to use the web app to view many different recipes on a larger screen. Then when it's time to cook, I can switch to the mobile app to follow the steps on a recipe I saved.

Search recipes by name

This can either be done on the client-side or the server-side using a full-text search.

Show additional recipe info

  • spice level: pill
  • vegetarian: pill
  • vegan: pill
  • gluten-free: pill
  • healthy: pill
  • cheap: pill
  • sustainable: pill
  • meal types: "Great for:"
  • culture: "Cultures:"

Pills below the title, others under the buttons?

Create web README

Populate the README with the following sections (at minimum):

  • Name of app
  • Workflow badges
  • Demo GIF
  • About
  • Links to related repos
  • Features
  • Directions
  • Attribution to the Edamam API

Create separate routes for each recipe item

Each route can be distinguished by the recipe's ID. This way it's easier to audit each recipe using Lighthouse (see #2). We can still have a SPA (single page app), maybe with transitions?

Low-effort filter recipes

We will evaluate if the following points are met on the client-side:

  • Uses 5 or fewer ingredients
  • Only uses common ingredients like chicken, potatoes, onions, and carrots. We want these recipes to be dishes people can put together with ingredients lying around the kitchen
  • 1 hour or less of cook time
  • Can make 3 or more servings

Show popovers for each cooking term

Similar to How to Stock, terms will be saved to localStorage/UserDefaults/DataStore (can move to IndexedDB/Core Data/Room with recent recipes if needed) and expire after 1 week to prevent data from being stale.

Steps to be done:

  1. On startup, check if terms are stored locally.
    a. If they are, check if they're expired.
    b. If they are, remove the terms.
  2. If no terms are stored or if they were deleted, get all terms via the API.
  3. Store the terms locally and set an expiration of 1 week.
  4. Upon opening a recipe, highlight all terms that appear on the screen and create a popover-like tool to view more information on hover/click/tap.

Show recipe details

Most of the following should appear in the MVP:

  • image
  • video
  • nutritional information
  • steps
  • time
  • allergy information
  • rating
  • save button
  • I made this! button
  • Show Me Another Recipe! button
  • share button

Add placeholder functionality for buttons

Not all the buttons will be used in the MVP, but since these apps will be deployed as part of the MVP, the buttons should do something so they don't appear useless/non-functional to users.

  • Hamburger icon: show a navigation drawer with the option to go home (technically should be replaced by a home button on larger screens)
  • Heart icon: toggle between liking and unliking a recipe, it doesn't need to be persisted, but this way the icon responds to user interaction
  • Share icon: open up the device's share dialog to share the recipe URL, on web maybe use navigator.share? Allow the user to copy the URL in case the browser doesn't support the share method
  • "I made this!" button - Show a Snackbar saying something like "Nice! Hope it was tasty!"

Show a friendly message when loading the recipes

It's in web, but could be applied to all the other clients.

Ideas:

  • Prepping the ingredients...
  • Preheating the oven...
  • Going grocery shopping...
  • Drying the meat...
  • Chopping onions... ๐Ÿ˜ญ
  • Dicing fruit...
  • Steaming veggies...
  • Applying condiments...
  • Spicing things up...
  • Melting the butter...
  • Mashing the potatoes...
  • Fluffing some rice...
  • Mixing things up...
  • Shaking things up...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.