Skip to content

ADR001 Local Web App MVP

The goal for this project is to automate receiving discount requests from friends/family, checking it for them, and returning the relevant results with as little interruption to me as possible.

Status

Complete

Context

Providing Wayfair discounts to friends and family is allowed and encouraged, but the discount is not a fixed amount and varies by wholesale cost, and therefore varies by product, shipping location, and time that it is checked. To perform a discount check for someone you need to either find the wholesale cost and apply the calculation, or manually add the product to your cart, and apply the employee discount check. Therefore, it's tedious to check discounts for people in a timely manner and without them feeling like they are bothering me.

Limitations

  • Getting wholesale price requires VPN access so it cannot be done in a hands-off automated way.
  • Password sharing is not an option.
  • I have friends in both US and Canada so will have to support wayfair.com and wayfair.ca
  • Getting discount info requires the product to be in your Wayfair cart and manually applying the employee discount to the cart.

Decision

Create a Next.js web application that will host a very basic input form for users to provide their zip/postal code and a link to a wayfair (.com or .ca) product page. Submitting the form will send the request to the backend server to be queued up, discount checked, and results saved for future reference for the user.

To do the actual discount fetching, a Puppeteer NodeJS script will be used

MVP Architecture

Consequences

  • The script can only be run one at a time, so a semaphore has to be used to restrict multiple requests from being executed simultanesously.
  • The api waits for the puppeteer script to finish, so it can result in a long user wait (especially if simultaneous requests are being processed).
  • Home server solution is scrappy, but would be better to host it in a free hosting environment like Vercel.
  • The puppeteer solution cannot be used off-prem due to security and botting detection reasons.
  • It's clunky to have to open the web app, paste a link, and have to wait for the results.