# ahmadkhalid007/saletracking architecture

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

- Interactive diagram: https://gitdiagram.com/ahmadkhalid007/saletracking
- Repository: https://github.com/ahmadkhalid007/saletracking

## Overview

SaleTracking is a web application for monitoring product prices and stock, with scheduled, time-windowed checks and configurable alerts. The main workflow is to create a tracking request, persist it, have the background processor check the product, and submit notifications through the selected channels. The application also provides account and settings management, dashboards, in-app notifications, SMTP administration, and a separate WhatsApp Web bridge. Relationships for unsampled subsystems are omitted or marked unverified rather than inferred from names alone.

Main entry points: [`SaleTracking/Services/PriceTrackingProcessor.cs`](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/PriceTrackingProcessor.cs) (Tracking processor), [`SaleTracking/wwwroot/js/site.js`](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/wwwroot/js/site.js) (Web interface), [`SaleTracking/Controllers/CreateController.cs`](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/CreateController.cs) (Create tracking), [`WhatsAppBridge/http-server.js`](https://github.com/ahmadkhalid007/saletracking/blob/master/WhatsAppBridge/http-server.js) (HTTP endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_web_ui["Web interface<br/>[site.js]"]
  node_account["Account management"]
  node_settings["Profile settings"]
  node_create["Create tracking"]
  node_dashboard["Tracking dashboard"]
  node_notifications_ui["Notification center"]
end

subgraph group_tracking["Tracking workflow"]
  node_schedule["Alert schedule"]
  node_processor["Tracking processor"]
  node_scraper["Product scraping"]
  node_track_model["Tracking record<br/>[TrackingItem.cs]"]
end

subgraph group_persistence["Persistence"]
  node_accounts_db[("Account store")]
  node_tracking_db[("Tracking store")]
  node_database[("SQLite database<br/>[SqliteDatabase.cs]")]
end

subgraph group_alerts["Alert delivery"]
  node_inapp["In-app alerts"]
  node_email_controller["Email settings<br/>[EmailController.cs]"]
  node_smtp_store[("SMTP configuration")]
  node_email_sender["Email delivery"]
  node_whatsapp_sender["WhatsApp delivery"]
end

subgraph group_bridge["WhatsApp bridge"]
  node_bridge_worker["Bridge worker"]
  node_bridge_server["Bridge server<br/>[server.js]"]
  node_http_server["HTTP endpoints<br/>[http-server.js]"]
  node_sender["Message sender<br/>[sender.js]"]
end

node_user(("User"))
node_whatsapp_web(("WhatsApp Web"))

node_user -.->|"uses"| node_web_ui
node_web_ui -.->|"submits requests"| node_account
node_web_ui -.->|"submits tracking"| node_create
node_web_ui -.->|"opens dashboard"| node_dashboard
node_create -->|"checks track"| node_processor
node_create -->|"gets local date"| node_schedule
node_dashboard -->|"checks track"| node_processor
node_processor -->|"checks eligibility"| node_schedule
node_processor -->|"checks tracking"| node_track_model
node_processor -.->|"scrapes product"| node_scraper
node_processor -.->|"reads and updates"| node_tracking_db
node_processor -.->|"creates notification"| node_inapp
node_processor -.->|"sends alert"| node_email_sender
node_processor -.->|"sends alert"| node_whatsapp_sender
node_accounts_db -->|"uses"| node_database
node_tracking_db -->|"uses"| node_database
node_inapp -->|"stores notifications"| node_database
node_email_controller -->|"reads and saves"| node_smtp_store
node_email_sender -->|"loads settings"| node_smtp_store
node_whatsapp_sender -->|"sends HTTP requests"| node_whatsapp_web
node_bridge_worker -.->|"checks bridge"| node_whatsapp_sender
node_bridge_server -->|"creates server"| node_http_server
node_bridge_server -->|"uses sender"| node_sender
node_http_server -->|"dispatches messages"| node_sender
node_http_server -.->|"serves bridge API"| node_whatsapp_web

click node_web_ui "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/wwwroot/js/site.js"
click node_account "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/AccountController.cs"
click node_settings "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/SettingsController.cs"
click node_create "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/CreateController.cs"
click node_dashboard "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/DashboardController.cs"
click node_notifications_ui "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/NotificationsController.cs"
click node_schedule "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/TrackingSchedule.cs"
click node_processor "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/PriceTrackingProcessor.cs"
click node_scraper "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/ShopifyProductScraping.cs"
click node_track_model "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Models/TrackingItem.cs"
click node_accounts_db "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/SqliteAccountStore.cs"
click node_tracking_db "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/SqliteTrackingStore.cs"
click node_database "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/SqliteDatabase.cs"
click node_inapp "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/InAppNotificationService.cs"
click node_email_controller "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/EmailController.cs"
click node_smtp_store "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/ISmtpConfigurationStore.cs"
click node_email_sender "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/EmailNotificationService.cs"
click node_whatsapp_sender "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/WhatsAppWebNotificationService.cs"
click node_bridge_worker "https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/WhatsAppBridgeWorker.cs"
click node_bridge_server "https://github.com/ahmadkhalid007/saletracking/blob/master/WhatsAppBridge/server.js"
click node_http_server "https://github.com/ahmadkhalid007/saletracking/blob/master/WhatsAppBridge/http-server.js"
click node_sender "https://github.com/ahmadkhalid007/saletracking/blob/master/WhatsAppBridge/sender.js"

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_web_ui,node_account,node_settings,node_create,node_dashboard,node_notifications_ui,node_user toneBlue
class node_schedule,node_processor,node_scraper,node_track_model toneAmber
class node_accounts_db,node_tracking_db,node_database toneMint
class node_inapp,node_email_controller,node_smtp_store,node_email_sender,node_whatsapp_sender toneRose
class node_bridge_worker,node_bridge_server,node_http_server,node_sender,node_whatsapp_web toneIndigo
```

## Components

### Web application

- [Web interface](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/wwwroot/js/site.js): `SaleTracking/wwwroot/js/site.js`
- [Account management](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/AccountController.cs): `SaleTracking/Controllers/AccountController.cs`
- [Profile settings](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/SettingsController.cs): `SaleTracking/Controllers/SettingsController.cs`
- [Create tracking](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/CreateController.cs): `SaleTracking/Controllers/CreateController.cs`
- [Tracking dashboard](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/DashboardController.cs): `SaleTracking/Controllers/DashboardController.cs`
- [Notification center](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/NotificationsController.cs): `SaleTracking/Controllers/NotificationsController.cs`

### Tracking workflow

- [Alert schedule](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/TrackingSchedule.cs): `SaleTracking/Services/TrackingSchedule.cs`
- [Tracking processor](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/PriceTrackingProcessor.cs): `SaleTracking/Services/PriceTrackingProcessor.cs`
- [Product scraping](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/ShopifyProductScraping.cs): `SaleTracking/Services/ShopifyProductScraping.cs`
- [Tracking record](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Models/TrackingItem.cs): `SaleTracking/Models/TrackingItem.cs`

### Persistence

- [Account store](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/SqliteAccountStore.cs): `SaleTracking/Services/SqliteAccountStore.cs`
- [Tracking store](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/SqliteTrackingStore.cs): `SaleTracking/Services/SqliteTrackingStore.cs`
- [SQLite database](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/SqliteDatabase.cs): `SaleTracking/Services/SqliteDatabase.cs`

### Alert delivery

- [In-app alerts](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/InAppNotificationService.cs): `SaleTracking/Services/InAppNotificationService.cs`
- [Email settings](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Controllers/EmailController.cs): `SaleTracking/Controllers/EmailController.cs`
- [SMTP configuration](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/ISmtpConfigurationStore.cs): `SaleTracking/Services/ISmtpConfigurationStore.cs`
- [Email delivery](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/EmailNotificationService.cs): `SaleTracking/Services/EmailNotificationService.cs`
- [WhatsApp delivery](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/WhatsAppWebNotificationService.cs): `SaleTracking/Services/WhatsAppWebNotificationService.cs`

### WhatsApp bridge

- [Bridge worker](https://github.com/ahmadkhalid007/saletracking/blob/master/SaleTracking/Services/WhatsAppBridgeWorker.cs): `SaleTracking/Services/WhatsAppBridgeWorker.cs`
- [Bridge server](https://github.com/ahmadkhalid007/saletracking/blob/master/WhatsAppBridge/server.js): `WhatsAppBridge/server.js`
- [HTTP endpoints](https://github.com/ahmadkhalid007/saletracking/blob/master/WhatsAppBridge/http-server.js): `WhatsAppBridge/http-server.js`
- [Message sender](https://github.com/ahmadkhalid007/saletracking/blob/master/WhatsAppBridge/sender.js): `WhatsAppBridge/sender.js`

### Other components

- **User**
- **WhatsApp Web**

## Connections

- User → Web interface: uses
- Web interface → Account management: submits requests
- Web interface → Create tracking: submits tracking
- Web interface → Tracking dashboard: opens dashboard
- Create tracking → Tracking processor: checks track (evidence: `SaleTracking/Controllers/CreateController.cs`)
- Create tracking → Alert schedule: gets local date (evidence: `SaleTracking/Controllers/CreateController.cs`)
- Tracking dashboard → Tracking processor: checks track (evidence: `SaleTracking/Controllers/DashboardController.cs`)
- Tracking processor → Alert schedule: checks eligibility (evidence: `SaleTracking/Services/PriceTrackingProcessor.cs`)
- Tracking processor → Tracking record: checks tracking (evidence: `SaleTracking/Services/PriceTrackingProcessor.cs`)
- Tracking processor → Product scraping: scrapes product
- Tracking processor → Tracking store: reads and updates
- Tracking processor → In-app alerts: creates notification
- Tracking processor → Email delivery: sends alert
- Tracking processor → WhatsApp delivery: sends alert
- Account store → SQLite database: uses (evidence: `SaleTracking/Services/SqliteAccountStore.cs`)
- Tracking store → SQLite database: uses (evidence: `SaleTracking/Services/SqliteTrackingStore.cs`)
- In-app alerts → SQLite database: stores notifications (evidence: `SaleTracking/Services/InAppNotificationService.cs`)
- Email settings → SMTP configuration: reads and saves (evidence: `SaleTracking/Controllers/EmailController.cs`)
- Email delivery → SMTP configuration: loads settings (evidence: `SaleTracking/Services/EmailNotificationService.cs`)
- WhatsApp delivery → WhatsApp Web: sends HTTP requests (evidence: `SaleTracking/Services/WhatsAppWebNotificationService.cs`)
- Bridge worker → WhatsApp delivery: checks bridge
- Bridge server → HTTP endpoints: creates server (evidence: `WhatsAppBridge/server.js`)
- Bridge server → Message sender: uses sender (evidence: `WhatsAppBridge/server.js`)
- HTTP endpoints → Message sender: dispatches messages (evidence: `WhatsAppBridge/http-server.js`)
- HTTP endpoints → WhatsApp Web: serves bridge API
