# antonio-pappalardo/amazon_price_tracker_bot architecture

> Architecture diagram of the GitHub repository antonio-pappalardo/amazon_price_tracker_bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/antonio-pappalardo/amazon_price_tracker_bot
- Repository: https://github.com/antonio-pappalardo/amazon_price_tracker_bot

## Overview

This is a scheduled Amazon price-tracking bot: it loads configured product links, scrapes product data, compares prices with stored history, and sends qualifying deal alerts to Telegram. The main runtime is implemented in main.py; scraper.py handles Amazon page retrieval and extraction, while database.py provides SQLite history and price queries. The README also describes optional polling and affiliate support, but polling is commented out and affiliate-link wiring is inactive in the sampled source. The graph reflects the default scan workflow; unsampled capabilities are not expanded into unsupported runtime components.

Main entry points: [`main.py`](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/main.py) (Price evaluator), [`database.py`](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/database.py) (History queries), [`scraper.py`](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/scraper.py) (Product scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Scan workflow"]
  node_link_input["Product links"]
  node_runner["Scan runner<br/>[main.py]"]
  node_evaluator["Price evaluator<br/>[main.py]"]
  node_alert_builder["Alert builder<br/>[main.py]"]
end

subgraph group_scraping["Product scraping"]
  node_scraper["Product scraper<br/>[scraper.py]"]
end

subgraph group_history["Price history"]
  node_db_api["History queries<br/>[database.py]"]
  node_price_store[("Price history<br/>[database.py]")]
end

node_operator(("Operator"))
node_telegram["Telegram"]
node_amazon["Amazon"]

node_operator -->|"starts scan"| node_runner
node_link_input -->|"provides links"| node_runner
node_runner -->|"initializes history"| node_db_api
node_runner -->|"runs scanner"| node_evaluator
node_evaluator -->|"fetches product"| node_scraper
node_scraper -->|"requests page"| node_amazon
node_evaluator -->|"queries and saves"| node_db_api
node_db_api -->|"reads and writes"| node_price_store
node_evaluator -->|"qualifies deal"| node_alert_builder
node_alert_builder -->|"sends alert"| node_telegram

click node_runner "https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/main.py"
click node_evaluator "https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/main.py"
click node_alert_builder "https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/main.py"
click node_scraper "https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/scraper.py"
click node_db_api "https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/database.py"
click node_price_store "https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/database.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_link_input,node_runner,node_evaluator,node_alert_builder toneBlue
class node_scraper toneAmber
class node_db_api,node_price_store toneMint
class node_operator,node_telegram,node_amazon toneIndigo
```

## Components

### Scan workflow

- **Product links**
- [Scan runner](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/main.py): `main.py`
- [Price evaluator](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/main.py): `main.py`
- [Alert builder](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/main.py): `main.py`

### Product scraping

- [Product scraper](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/scraper.py): `scraper.py`

### Price history

- [History queries](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/database.py): `database.py`
- [Price history](https://github.com/antonio-pappalardo/amazon_price_tracker_bot/blob/main/database.py): `database.py`

### Other components

- **Operator**
- **Telegram**
- **Amazon**

## Connections

- Operator → Scan runner: starts scan (evidence: `README.md`)
- Product links → Scan runner: provides links (evidence: `main.py`)
- Scan runner → History queries: initializes history (evidence: `main.py`)
- Scan runner → Price evaluator: runs scanner (evidence: `main.py`)
- Price evaluator → Product scraper: fetches product (evidence: `main.py`)
- Product scraper → Amazon: requests page (evidence: `scraper.py`)
- Price evaluator → History queries: queries and saves (evidence: `main.py`)
- History queries → Price history: reads and writes (evidence: `database.py`)
- Price evaluator → Alert builder: qualifies deal (evidence: `main.py`)
- Alert builder → Telegram: sends alert (evidence: `main.py`)
