This Recipe App allows users to browse and search for recipes, save their favorite recipes, and apply filters to find specific types of recipes. Built with ReactJS, Redux, and styled using CSS, this app allows users to interact with a recipe API, view detailed recipes, and manage a list of favorites.
- Browse Recipes: Users can browse through a collection of recipes fetched from an external API.
- Search Recipes: Allows users to search for recipes based on keywords, ingredients, or dietary preferences (e.g., vegetarian, gluten-free).
- Recipe Details: Displays detailed information about recipes, including ingredients, instructions, preparation time, and serving size.
- Favorites: Users can mark recipes as favorites and view them in a favorites list.
- Filters: Recipes can be filtered based on categories like breakfast, lunch, dinner, or dietary restrictions.
- State Management: Utilizes Redux for state management, including actions, reducers, and the store.
- Loading State: A loading spinner is displayed while fetching data from the API.
- Alert System: A notification/alert system that informs users about important actions, such as empty search results.
- Frontend: ReactJS, Redux, CSS
- State Management: Redux
- API: Edamam Recipe API (https://api.edamam.com)
- Styling: Plain CSS (can be extended to SCSS or CSS-in-JS)
src/
├── api/
│ └── recipeApi.js # Contains API fetching logic
├── Components/
│ ├── Alert.js # Displays alerts or notifications
│ ├── Favourite.js # Handles displaying and managing favorites
│ ├── Home.js # Main home page with recipe search and listing
│ ├── Loader.js # Displays loading spinner during API calls
│ ├── Main.css # Main CSS file for styling
│ ├── Main.js # Main file that aggregates other components
│ ├── NavBar.js # Navigation bar for the app
│ ├── RecipeInstruction.js # Displays detailed recipe instructions
│ ├── SearchList.js # Displays list of searched recipes
│ └── SearchListAlert.js # Displays alert for no search results
├── Redux/
│ ├── RecipeActions.js # Redux actions for fetching and managing recipes
│ ├── RecipeReducer.js # Redux reducer for managing recipe state
│ ├── RecipeTypes.js # Action types for recipes
│ └── store.js # Redux store configuration
├── App.js # Main app component
├── App.test.js # Test file for the App component
├── index.css # Global CSS styles
├── index.js # Entry point for React app
├── reportWebVitals.js # Measures app performance
├── setupTests.js # Sets up testing environment
├── .gitignore # Git ignore file
├── README.md # Project documentation
└── package.json # Project dependencies and scripts
The app fetches recipe data from the Edamam Recipe API. It uses the following API endpoint to get recipes based on user input:
https://api.edamam.com/search?q={query}&app_id={your_app_id}&app_key={your_app_key}&from=0&to=50
To start fetching recipe data, you'll need to replace the API credentials (app_id and app_key) in the recipeApi.js
file, located in the src/api/
folder.
- Go to Edamam API and sign up for an API key.
- Replace the following variables in the
recipeApi.js
file with your own credentials:
const appId = 'your_app_id';
const appKey = 'your_app_key';
Before you begin, ensure that you have the following installed:
- Node.js (version 12 or higher)
- npm (Node Package Manager)
-
Clone the repository to your local machine:
git clone https://github.com/your-username/Recipe-App-FE.git cd Recipe-App-FE
-
Install the project dependencies:
npm install
-
Set up your API credentials:
- Follow the instructions above to obtain your API keys from Edamam and update them in the
src/api/recipeApi.js
file.
- Follow the instructions above to obtain your API keys from Edamam and update them in the
-
Start the app locally:
npm start
The app should now be running on
http://localhost:3000
.
The app allows users to search for recipes based on:
- Keywords (e.g., "pizza", "pasta").
- Ingredients (e.g., "chicken", "spinach").
- Dietary restrictions (e.g., vegetarian, gluten-free).
When a user selects a recipe, they can see:
- Ingredients: A list of ingredients needed to make the recipe.
- Instructions: Step-by-step guide to preparing the dish.
- Preparation time and Serving size.
- Users can mark recipes as favorites, which will then be saved in the state and accessible in the "Favorites" section.
Users can filter recipes based on:
- Meal type (e.g., breakfast, lunch, dinner).
- Dietary restrictions (e.g., vegetarian, gluten-free).
The app displays a loading spinner while fetching data from the API and shows an error message if no recipes are found.
An alert system notifies users if no recipes match the search criteria or if there is an issue with fetching data from the API.
Actions are responsible for dispatching API calls and updating the state with the fetched recipe data.
Reducers handle the state changes based on dispatched actions, updating the app state with the list of recipes, favorite recipes, and any search-related data.
The store configures the app’s state management with Redux and integrates it with React using the Provider
component.
Testing is set up using Jest and React Testing Library. You can run the tests by executing:
npm test
You can deploy the app to services like Vercel, Netlify, or GitHub Pages. These platforms will automatically build and deploy your React app from your repository.