An open API service indexing awesome lists of open source software.

https://github.com/mario-lupo-ciaponi/vkusiada

Still in progress.
https://github.com/mario-lupo-ciaponi/vkusiada

Last synced: 4 months ago
JSON representation

Still in progress.

Awesome Lists containing this project

README

        

# Vkusiada

## Overview:

The Recipe Finder Web App is a Flask-based web application that allows users to register, log in,
and manage their ingredient lists. Users can search for recipes based on available ingredients,
save recipes, and manage their profiles. The app integrates with [TheMealDB API](https://www.themealdb.com/)
to fetch recipe data.

## Features:

- **User Authentication**: Register, log in, and manage sessions with Flask sessions.
- **Ingredient Management**: Add and delete ingredients specific to each user.
- **Recipe Search**: Fetch recipes from TheMealDB API based on user ingredients.
- **Save Recipes**: Store favorite recipes for later reference.
- **User Profile Management**: View and delete user accounts.
- **Contact Form**: Allow users to send messages via the contact page.

## Technologies Used:

- **Backend**: Flask (Python), MySQL
- **Frontend**: HTML, CSS, Jinja2 Templates
- **Database**: MySQL (with `mysql.connector`)
- **Security**: Password hashing with `werkzeug.security`
- **External API**: [TheMealDB API](https://www.themealdb.com/)

## Installation:

### Prerequisites:

Ensure you have the following installed:

- Python (>=3.7)
- MySQL Server
- Pip (Python package manager)

### Steps to Install:

1. **Clone the Repository**:

```shell
git clone https://github.com/Mario-Lupo-Ciaponi/Vkusiada.git
```

2. **Create a Virtual Environment**:

```shell
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```

3. **Install Dependencies**:

```shell
pip install -r requirements.txt
```

4. **Set Up MySQL Database**:

- Create a MySQL database named `flask_app`
- Update `db_config` in `app.py` with your database credentials.
- Run the following SQL commands:
```mysql
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE ingredients (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) UNIQUE NOT NULL
);

CREATE TABLE user_ingredients (
user_id INT,
ingredient_id INT,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (ingredient_id) REFERENCES ingredients(id) ON DELETE CASCADE
);

CREATE TABLE saved_recipes (
user_id INT,
recipe_id VARCHAR(100),
recipe_name VARCHAR(255),
instructions TEXT,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
```

5. Run the Flask App:

```shell
python app.py
```

Access the app at `http://127.0.0.1:5000/`

## Usage:

- **Register** and **log in** to the app.
- Navigate to the **Ingredients** page to add your ingredients.
- Visit the **Recipes** page to find meals based on your ingredients.
- Save your favorite recipes for later reference.
- Manage your profile and delete your account if needed.

## API Integration:

The app interacts with [TheMealDB API](https://www.themealdb.com/) for recipe data:

- Fetch recipes based on ingredients: `https://www.themealdb.com/api/json/v1/1/filter.php?i={ingredient}`
- Fetch full recipe details: `https://www.themealdb.com/api/json/v1/1/lookup.php?i={recipe_id}`

## Security Considerations:

- Passwords are securely hashed using `generate_password_hash()`.
- User sessions are managed securely using Flask sessions with a secret key.
- Input validation is implemented to prevent SQL injection and XSS attacks.

## License:

This project is licensed under the MIT License.

## Contact:

For questions or suggestions, please open an issue on the GitHub repository.