# adrianhajdin/pricewise architecture

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

- Interactive diagram: https://gitdiagram.com/adrianhajdin/pricewise
- Repository: https://github.com/adrianhajdin/pricewise

## Overview

PriceWise is an Amazon product price-tracking application. A shopper submits an Amazon URL, which the server scrapes and stores; the home page lists tracked products, and a product page offers price details and an email opt-in. A scheduled cron route refreshes stored products, updates price history, and sends alerts for price drops, discounts, or restocks. The graph includes the documented carousel and product views. Source excerpts show the principal calls; unsampled integrations and scheduling are limited to README evidence or marked unverified.

Main entry points: [`lib/actions/index.ts`](https://github.com/adrianhajdin/pricewise/blob/main/lib/actions/index.ts) (Product actions), [`app/api/cron/route.ts`](https://github.com/adrianhajdin/pricewise/blob/main/app/api/cron/route.ts) (Scheduled refresh), [`app/page.tsx`](https://github.com/adrianhajdin/pricewise/blob/main/app/page.tsx) (Home page), [`lib/scraper/index.ts`](https://github.com/adrianhajdin/pricewise/blob/main/lib/scraper/index.ts) (Amazon scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Shopper experience"]
  node_home["Home page<br/>[page.tsx]"]
  node_carousel["Hero carousel<br/>[HeroCarousel.tsx]"]
  node_search["Product search<br/>[Searchbar.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
  node_layout["App layout<br/>[layout.tsx]"]
  node_product_cards["Product cards<br/>[ProductCard.tsx]"]
  node_detail_page["Product details<br/>[page.tsx]"]
  node_tracking_modal["Tracking opt-in<br/>[Modal.tsx]"]
  node_price_cards["Price summaries<br/>[PriceInfoCard.tsx]"]
end

subgraph group_tracking["Product tracking"]
  node_actions["Product actions<br/>[index.ts]"]
  node_cron["Scheduled refresh<br/>[route.ts]"]
  node_scraper["Amazon scraper<br/>[index.ts]"]
  node_price_utils["Price and alert rules<br/>[utils.ts]"]
end

subgraph group_persistence["Product persistence"]
  node_product_model["Product model<br/>[product.model.ts]"]
  node_db_connection["DB connection<br/>[mongoose.ts]"]
end

subgraph group_alerts["Notifications"]
  node_email_service["Email generation and delivery<br/>[index.ts]"]
end

node_shopper(("Shopper"))
node_amazon["Amazon product pages"]
node_bright_data["Bright Data proxy"]
node_mongodb[("MongoDB")]
node_mail_provider["Outlook mail service"]
node_scheduler(("Cron scheduler"))

node_shopper -->|"browses"| node_home
node_home -->|"renders"| node_carousel
node_home -->|"renders"| node_search
node_home -->|"loads products"| node_actions
node_home -->|"renders"| node_product_cards
node_layout -->|"renders"| node_navbar
node_shopper -->|"submits URL"| node_search
node_search -->|"invokes scrape"| node_actions
node_actions -->|"connects"| node_db_connection
node_actions -->|"queries and updates"| node_product_model
node_actions -->|"scrapes URL"| node_scraper
node_actions -->|"calculates prices"| node_price_utils
node_actions -->|"sends welcome"| node_email_service
node_scraper -->|"fetches page"| node_amazon
node_scraper -->|"configures proxy"| node_bright_data
node_scraper -->|"extracts fields"| node_price_utils
node_product_cards -->|"links to"| node_detail_page
node_detail_page -->|"loads product data"| node_actions
node_detail_page -->|"renders"| node_tracking_modal
node_detail_page -->|"renders"| node_price_cards
node_tracking_modal -->|"registers email"| node_actions
node_cron -->|"connects"| node_db_connection
node_cron -->|"reads and updates"| node_product_model
node_cron -->|"refreshes products"| node_scraper
node_cron -->|"computes alerts"| node_price_utils
node_cron -->|"sends alerts"| node_email_service
node_scheduler -.->|"triggers"| node_cron
node_db_connection -.->|"connects"| node_mongodb
node_email_service -->|"sends mail"| node_mail_provider

click node_home "https://github.com/adrianhajdin/pricewise/blob/main/app/page.tsx"
click node_carousel "https://github.com/adrianhajdin/pricewise/blob/main/components/HeroCarousel.tsx"
click node_search "https://github.com/adrianhajdin/pricewise/blob/main/components/Searchbar.tsx"
click node_navbar "https://github.com/adrianhajdin/pricewise/blob/main/components/Navbar.tsx"
click node_layout "https://github.com/adrianhajdin/pricewise/blob/main/app/layout.tsx"
click node_product_cards "https://github.com/adrianhajdin/pricewise/blob/main/components/ProductCard.tsx"
click node_detail_page "https://github.com/adrianhajdin/pricewise/blob/main/app/products/%5Bid%5D/page.tsx"
click node_tracking_modal "https://github.com/adrianhajdin/pricewise/blob/main/components/Modal.tsx"
click node_price_cards "https://github.com/adrianhajdin/pricewise/blob/main/components/PriceInfoCard.tsx"
click node_actions "https://github.com/adrianhajdin/pricewise/blob/main/lib/actions/index.ts"
click node_cron "https://github.com/adrianhajdin/pricewise/blob/main/app/api/cron/route.ts"
click node_scraper "https://github.com/adrianhajdin/pricewise/blob/main/lib/scraper/index.ts"
click node_price_utils "https://github.com/adrianhajdin/pricewise/blob/main/lib/utils.ts"
click node_product_model "https://github.com/adrianhajdin/pricewise/blob/main/lib/models/product.model.ts"
click node_db_connection "https://github.com/adrianhajdin/pricewise/blob/main/lib/mongoose.ts"
click node_email_service "https://github.com/adrianhajdin/pricewise/blob/main/lib/nodemailer/index.ts"

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_home,node_carousel,node_search,node_navbar,node_layout,node_product_cards,node_detail_page,node_tracking_modal,node_price_cards toneBlue
class node_actions,node_cron,node_scraper,node_price_utils,node_mongodb toneAmber
class node_product_model,node_db_connection toneMint
class node_email_service,node_scheduler toneRose
class node_shopper,node_amazon,node_bright_data,node_mail_provider toneIndigo
```

## Components

### Shopper experience

- [Home page](https://github.com/adrianhajdin/pricewise/blob/main/app/page.tsx): `app/page.tsx`
- [Hero carousel](https://github.com/adrianhajdin/pricewise/blob/main/components/HeroCarousel.tsx): `components/HeroCarousel.tsx`
- [Product search](https://github.com/adrianhajdin/pricewise/blob/main/components/Searchbar.tsx): `components/Searchbar.tsx`
- [Navigation](https://github.com/adrianhajdin/pricewise/blob/main/components/Navbar.tsx): `components/Navbar.tsx`
- [App layout](https://github.com/adrianhajdin/pricewise/blob/main/app/layout.tsx): `app/layout.tsx`
- [Product cards](https://github.com/adrianhajdin/pricewise/blob/main/components/ProductCard.tsx): `components/ProductCard.tsx`
- [Product details](https://github.com/adrianhajdin/pricewise/blob/main/app/products/%5Bid%5D/page.tsx): `app/products/[id]/page.tsx`
- [Tracking opt-in](https://github.com/adrianhajdin/pricewise/blob/main/components/Modal.tsx): `components/Modal.tsx`
- [Price summaries](https://github.com/adrianhajdin/pricewise/blob/main/components/PriceInfoCard.tsx): `components/PriceInfoCard.tsx`

### Product tracking

- [Product actions](https://github.com/adrianhajdin/pricewise/blob/main/lib/actions/index.ts): `lib/actions/index.ts`
- [Scheduled refresh](https://github.com/adrianhajdin/pricewise/blob/main/app/api/cron/route.ts): `app/api/cron/route.ts`
- [Amazon scraper](https://github.com/adrianhajdin/pricewise/blob/main/lib/scraper/index.ts): `lib/scraper/index.ts`
- [Price and alert rules](https://github.com/adrianhajdin/pricewise/blob/main/lib/utils.ts): `lib/utils.ts`

### Product persistence

- [Product model](https://github.com/adrianhajdin/pricewise/blob/main/lib/models/product.model.ts): `lib/models/product.model.ts`
- [DB connection](https://github.com/adrianhajdin/pricewise/blob/main/lib/mongoose.ts): `lib/mongoose.ts`

### Notifications

- [Email generation and delivery](https://github.com/adrianhajdin/pricewise/blob/main/lib/nodemailer/index.ts): `lib/nodemailer/index.ts`

### Other components

- **Shopper**
- **Amazon product pages**
- **Bright Data proxy**
- **MongoDB**
- **Outlook mail service**
- **Cron scheduler**

## Connections

- Shopper → Home page: browses (evidence: `README.md`)
- Home page → Hero carousel: renders (evidence: `app/page.tsx`)
- Home page → Product search: renders (evidence: `app/page.tsx`)
- Home page → Product actions: loads products (evidence: `app/page.tsx`)
- Home page → Product cards: renders (evidence: `app/page.tsx`)
- App layout → Navigation: renders (evidence: `app/layout.tsx`)
- Shopper → Product search: submits URL (evidence: `components/Searchbar.tsx`)
- Product search → Product actions: invokes scrape (evidence: `components/Searchbar.tsx`)
- Product actions → DB connection: connects (evidence: `lib/actions/index.ts`)
- Product actions → Product model: queries and updates (evidence: `lib/actions/index.ts`)
- Product actions → Amazon scraper: scrapes URL (evidence: `lib/actions/index.ts`)
- Product actions → Price and alert rules: calculates prices (evidence: `lib/actions/index.ts`)
- Product actions → Email generation and delivery: sends welcome (evidence: `lib/actions/index.ts`)
- Amazon scraper → Amazon product pages: fetches page (evidence: `lib/scraper/index.ts`)
- Amazon scraper → Bright Data proxy: configures proxy (evidence: `lib/scraper/index.ts`)
- Amazon scraper → Price and alert rules: extracts fields (evidence: `lib/scraper/index.ts`)
- Product cards → Product details: links to (evidence: `components/ProductCard.tsx`)
- Product details → Product actions: loads product data (evidence: `app/products/[id]/page.tsx`)
- Product details → Tracking opt-in: renders (evidence: `app/products/[id]/page.tsx`)
- Product details → Price summaries: renders (evidence: `app/products/[id]/page.tsx`)
- Tracking opt-in → Product actions: registers email (evidence: `components/Modal.tsx`)
- Scheduled refresh → DB connection: connects (evidence: `app/api/cron/route.ts`)
- Scheduled refresh → Product model: reads and updates (evidence: `app/api/cron/route.ts`)
- Scheduled refresh → Amazon scraper: refreshes products (evidence: `app/api/cron/route.ts`)
- Scheduled refresh → Price and alert rules: computes alerts (evidence: `app/api/cron/route.ts`)
- Scheduled refresh → Email generation and delivery: sends alerts (evidence: `app/api/cron/route.ts`)
- Cron scheduler → Scheduled refresh: triggers (evidence: `README.md`)
- DB connection → MongoDB: connects (evidence: `README.md`)
- Email generation and delivery → Outlook mail service: sends mail (evidence: `lib/nodemailer/index.ts`)
