Skip to content

the-vindex/auto-order

 
 

Repository files navigation

Timely Buyer

Track sales on your favorite items, all in one place!

Screenshot of Timely Buyer

Motivation

Online shoppers often come across products they want but prefer to wait for a sale before purchasing. This project was built to centralize and track those "wait-for-a-sale" items in one place. Users can register products, set a target price, and receive a notification when the item's price drops below their specified threshold — helping them buy at the right time without constantly checking for deals.

How It Works

After a user has registered, they have the ability to create 'product reminders' in the home page. Here, one can enter a URL for the product and set a target price to receive a notification. Our service then fetches the price from the provided URL and uses that information to populate the entry in the home page. Then, on regular intervals, Timely Buyer will check the current price of the item. If the current price has dropped below the user-specified target price, a notification is sent to the user's email!

Super quick start

Head over to: https://timely.tier-zero.co.uk/

  • Register with any (even fake) email.
  • Note: When you add a product reminder we scrape Amazon.com for it's price. It's not 100 % reliable, sorry for that! In case we fail to scrape, we won't add item to the list.
  • Hosted on Google Cloud Platform.
  • SSL by Let's Encrypt.

Quick Start

To quickly setup the application locally, follow these steps. Alternatively, if you are looking to set the project up for development, see the Development Steps section.

  1. Install modern docker (or docker-compose) on your machine.

  2. Clone the repository:

    git clone https://github.com/the-vindex/auto-order.git
  3. Navigate to the project directory:

    cd auto-order
  4. Copy over test.env.example to test.env:

    cp test.env.example test.env
  5. Set up JWT Secret, used for creating JWTs:

  6.  echo JWT_TOKEN=your_secret_key > jwt.secret
  7. (OPTIONAL) Set Up Resend Account To receive email notifications in development, a resend api key is needed. Go to resend.com, create an account, and get an API key. Use this api key in your .env file, as RESEND_API_KEY. Ensure the email you use when tseting this app is the same one you use to create your resend account.

  8. Start the application using script below.

    ./start-stop.sh --test

    If you use Rootless Docker, you will need this - drop a file to allow user binding ports below 1024:

    sudo echo 'net.ipv4.ip_unprivileged_port_start = 80' > /etc/sysctl.d/99-unprivileged-ports.conf
    sudo sysctl --system
  9. Open your browser at https://localhost

Development Setup

Database Setup

  1. Navigate to the backend directory:

Backend Development

  1. Navigate to the backend directory:
    cd auto-order/backend
  2. Create a .env file from the example. This file will hold your local environment variables, including the database URL and JWT secret.
    cp .env.example .env
    # Edit .env with your local database connection string and JWT_SECRET
  3. Start the database with docker compose:
docker compose up -d
  1. Install backend dependencies:
    npm install
  2. Puppeteer needs some additional setup, namely installing the Chromium browser. This can be done by running:
    npx puppeteer install
    You will also need to follow https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md.
    • Applies to Ubuntu 23+, best case you have Chrome installed through apt and end up adding following line to .bashrc:
    export CHROME_DEVEL_SANDBOX=/usr/lib/chromium-browser/chrome-sandbox
  3. Start the backend in development mode:
    npm run dev
    The backend will run on http://localhost:3000 (or the port specified in your .env).

Frontend Development

  1. Navigate to the React frontend directory:
    cd auto-order/react
  2. Install frontend dependencies:
    npm install
  3. Start the frontend development server:
    npm run dev
    The frontend will typically run on http://localhost:5173.

Nifty tools

  1. To start both FE and BE for development, use dev.sh script:
    ./dev.sh
    This will start both the backend and frontend servers concurrently, plus postgres in the background.

Tech Stack

  • Backend: Node.js, Express.js
  • Frontend: React
  • Database: PostgreSQL
  • Containerization: Docker

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •