Wade Stern Projects

System Architecture

System-Architecture

Frontend:

  • Functions include:
    • Provide web server functionality.
    • Render web pages.
    • Communicate to backend via RestAPI.
    • Cache some user session information.
  • Buy Potato Frontend utilizes Node.js for its development environment and build tools.
  • The user interface was developed using React, a JavaScript library specifically designed for creating interactive user interfaces.
  • Axios is employed on the frontend to send HTTP requests from the user's browser with a rest API to the backend.

Backend

  • Functions include:
    • Expose API routes and act as a wrapper for database interactions.
    • Provide logic for actions such as recipe of the week and logic for applying user preferences to queries.
    • Generate and submit queries to database.
    • Package database responses and send them to the frontend
  • The backend is built with python and utilizes SQL scripts.
  • FastAPI is used to send responses to the frontend.

Database

The database, powered by MariaDB, follows a relational model and utilizes SQL for data management. Originally the database was hosted locally, but it has since been moved to AWS Relational Database Service

Tables

DB-Tables

Users - contains the users' login information. This table receives entries when users sign up. The passwords are stored hashed for security.

Userdata - Contains information collected from the survey. Users_id is the foreign key that ties it to the Users table. This information is used in the algorithm that recommends recipes.

Recipe - This table contains all of the recipes that are available on the website. This data is used to populate the recipe cards.

DislikedRecipes / LikedRecipes - These tables have the same columns. They have a foreign key for both user_id and recipe_id. They are used by joining them to the users and recipe table to find the recipes that each user either likes or dislikes.

Data collection

A web scraper was used to collect recipe information from the internet. Entries that did not have data for necessary fields were dropped. The rest of the tables are populated when the user performs actions associated with the tables.

Management

MariaDB is the system that is used to manage the database. Originally the database was hosted locally, but to improve ease of access and consistency, it was moved to AWS Relational Database Service.

Redundancy

RDS makes backups of the database and saves the three most recent in case of errors. The SQL backup files that were used to set up the database are also saved in case a full reset is necessary.

Cost minimization

To minimize unnecessary uptime on the database, Lambda functions were set up to take down the database and restore it once a week for updates. RDS does not allow indefinite stoppage of its databases because they need to be up for the weekly updates, so the lambda function needs to be scheduled to run once a week. This function is currently not being used because the database is included in the AWS free tier.