Skip to content

๐ŸŽ A web app that notifies users when Woolworths products are on special

License

Notifications You must be signed in to change notification settings

emanmacario/smart-saver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ Smart Saver

Smart Saver is a web application that allows for automatic notification of users regarding specials on their favourite Woolworths products.

โšก Motivation

The motivation behind building this web application was to automate the tedious and repetitive task of checking whether Woolworths products are on special, using their website.

This is handy for products that are seldom on special, such as dog food, canned tuna and peanut butter etc. which can be bought in bulk to save money.

Rather than checking every few days, a user can just add multiple products at once and automatically receive a notification email whenever a product goes on special.

๐Ÿ’ป Technologies Used

This project was bootstrapped with Create React App.

This website was built using:

The build specification reference for AWS CodeBuild can be seen in buildspec.yml.

๐Ÿ—๏ธ Backend Architecture

The backend uses a simple three-layer architecture, including controllers (Express routes), a service layer, and a data access layer (Mongoose ODM). This is to abide by the principle of separation of concerns, and to avoid putting business logic inside the controllers.

The directory structure can be seen below:

.
โ”œโ”€โ”€ config             # Environment variables
โ”œโ”€โ”€ controllers        # Express Route controllers
โ”‚ย ย  โ”œโ”€โ”€ middlewares    # Express middlewares (e.g. authentication middleware)
โ”‚ย ย  โ””โ”€โ”€ routes         # Routes for API endpoints
โ”œโ”€โ”€ jobs               # CRON jobs
โ”œโ”€โ”€ loaders            # Split the server startup process into modules
โ”œโ”€โ”€ models             # MongoDB database models
โ”œโ”€โ”€ realm              # MongoDB Realm serverless functions
โ”œโ”€โ”€ services           # Service classes that contain business logic
โ””โ”€โ”€ server.js          # Application entry point

๐Ÿ”’ Configuring HTTPS for the Backend Server

The backend API is configured to use HTTPS. The steps below indicate how to set up HTTPS for an AWS Elastic Beanstalk environment (mostly for my reminder, so I don't forget ๐Ÿ˜›).

  1. Get an SSL certificate for the backend API server domain from AWS Certificate Manager (or Let's Encrypt)
    • Need to set MX or forward email from *@SERVER_DOMAIN to your personal email
  2. Create an application load balancer with a HTTPS listener on port 443 using the certificate (leave security groups as is), using the default SSL ELBSecurityPolicy
  3. Don't forget to set environment variables in the AWS Elastic Beanstalk environment!

โŒจ๏ธ Usage

The repository contains a docker-compose.yml file for local deployment on any operating system. First, you need to create .env files in both the backend and frontend directories.

A sample .env file for backend:

PORT=5000
MONGODB_URI=mongodb://mongodb0.example.com:27017
EMAIL=example@gmail.com
PASSWORD=supersecretpassword
ORIGIN=http://localhost:3000
SECRET=supersecretkey
NODE_ENV=development

A sample .env file for frontend:

REACT_APP_SERVER=http://localhost:5000

To run the application, ensure you have Docker and Docker Compose installed. Then, run:

$ docker-compose up --build

๐Ÿ”ฎ Future Features/Improvements

  • More emphasis on responsive design to better support mobile devices
  • Add a cart system so users can see how much they can potentially save when purchasing on-special products
  • Opt-in settings to turn off notification emails, and the ability to explicitly set personalised notification times

๐Ÿ“„ License

MIT ยฉ Emmanuel Macario

๐Ÿค“ Attribution

Made by Emmanuel Macario

About

๐ŸŽ A web app that notifies users when Woolworths products are on special

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published