Skip to content

Repository files navigation

Scrappy — Amazon Price Tracker

A self-hosted Amazon price tracker that monitors product prices over time and sends email alerts when your target price is hit. Built with Python, FastAPI, SQLite, and React.


Demo

[https://youtu.be/1Mk60u60mic?si=-QW72TLr7iP8EaX6]


Features

  • Track multiple Amazon products simultaneously
  • Logs price history on every check and surfaces the lowest recorded price
  • Email alerts via Gmail when a product hits your target price — with spam prevention so you only get one alert per day per product
  • Automated background price checks via cron, runs every 6 hours
  • Manual price check trigger from the dashboard
  • Add, update target price, and delete tracked products from a clean React frontend

Tech Stack

Layer Technology
Backend FastAPI, Python
Database SQLite
Scraping Requests, BeautifulSoup4
Email smtplib, Gmail App Password
Frontend React, Vite
Automation Cron

Project Structure

Scrappy/
├── scrapper.py        # Fetches product title and price from Amazon
├── database.py        # SQLite setup and all DB queries
├── emailer.py         # Sends price alert emails via Gmail
├── tracker.py         # Core logic — loops all products, checks prices, triggers alerts
├── app.py             # FastAPI backend serving all endpoints
├── .env               # Credentials (not committed)
├── tracker.log        # Cron output log
└── frontend/          # React + Vite frontend

Setup

1. Clone and create virtual environment

git clone https://github.com/yourusername/scrappy.git
cd scrappy
python3 -m venv venv
source venv/bin/activate
pip install requests beautifulsoup4 python-dotenv fastapi uvicorn

2. Configure environment variables

Create a .env file in the root:

SENDER_EMAIL=yourgmail@gmail.com
APP_PASSWORD=xxxx xxxx xxxx xxxx
RECEIVER_EMAIL=yourgmail@gmail.com

To generate a Gmail App Password: Google Account > Security > 2-Step Verification > App Passwords.

3. Run the backend

uvicorn app:app --reload

4. Run the frontend

cd frontend
npm install
npm run dev

5. Set up cron for automated checks

crontab -e

Add this line:

0 */6 * * * cd /path/to/Scrappy && /path/to/Scrappy/venv/bin/python tracker.py >> /path/to/Scrappy/tracker.log 2>&1

How It Works

  1. User adds an Amazon product URL and sets a target price via the frontend
  2. The backend scrapes the current price and saves it to the database
  3. Every 6 hours, cron runs tracker.py which checks all tracked products
  4. Each price check is logged to price_history — the lowest ever recorded is always available
  5. If the current price is at or below the target, an email alert is sent
  6. A last_alerted timestamp prevents duplicate alerts on the same day

API Endpoints

Method Endpoint Description
GET /products Get all tracked products
POST /products/add Add a new product
DELETE /products/{id} Delete a product
POST /products/{id}/update Update target price
POST /run-check Manually trigger a price check

Notes

  • This project is intended for personal use
  • Amazon's scraping tolerance varies — occasional blocks may occur
  • Cron only runs while your machine is on

About

Amazon price tracker built with Python and React. Monitors multiple products, logs price history, and sends automated email alerts when target prices are hit.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages