# machacekmartin/twingo-notifier architecture

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

- Interactive diagram: https://gitdiagram.com/machacekmartin/twingo-notifier
- Repository: https://github.com/machacekmartin/twingo-notifier

## Overview

This repository is a scheduled Renault Twingo listing notifier. Its workflow scrapes three marketplaces, combines their offers, compares IDs with the persisted JSON history, then records new offers and writes an HTML email body for the automation to send. The README also documents scheduled GitHub Actions runs, repository write access, and SMTP configuration. Scraper and main-script relationships are visible in excerpts; the scheduler and mail-sending workflow are documented but their workflow source was not provided, so those links are shown as unverified.

Main entry points: [`index.js`](https://github.com/machacekmartin/twingo-notifier/blob/main/index.js) (Notifier runner), [`twingos-email.html`](https://github.com/machacekmartin/twingo-notifier/blob/main/twingos-email.html) (Email body file), [`twingos.json`](https://github.com/machacekmartin/twingo-notifier/blob/main/twingos.json) (Offer history), [`scrapers/bazoscz.js`](https://github.com/machacekmartin/twingo-notifier/blob/main/scrapers/bazoscz.js) (Bazos scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Marketplace collection"]
  node_bazos["Bazos scraper<br/>[bazoscz.js]"]
  node_sbazar["Sbazar scraper<br/>[sbazarcz.js]"]
  node_sauto["Sauto scraper<br/>[sautocz.js]"]
end

subgraph group_processing["Detection and output"]
  node_runner["Notifier runner<br/>[index.js]"]
  node_history[("Offer history<br/>[twingos.json]")]
  node_newoffers["New-offer detection<br/>[index.js]"]
  node_historywrite["History update<br/>[index.js]"]
  node_emailbody["Email body generation<br/>[index.js]"]
  node_emailfile["Email body file<br/>[twingos-email.html]"]
end

node_scheduler(("Scheduled run"))
node_smtp["SMTP mail service"]
node_recipient(("Configured recipient"))

node_scheduler -.->|"starts run"| node_runner
node_runner -->|"scrapes listings"| node_bazos
node_runner -->|"scrapes listings"| node_sbazar
node_runner -->|"scrapes listings"| node_sauto
node_runner -->|"reads"| node_history
node_runner -->|"compares IDs"| node_newoffers
node_newoffers -->|"triggers update"| node_historywrite
node_historywrite -->|"appends offers"| node_history
node_newoffers -->|"triggers generation"| node_emailbody
node_emailbody -->|"writes HTML"| node_emailfile
node_emailfile -.->|"sent by workflow"| node_smtp
node_smtp -.->|"emails alerts"| node_recipient

click node_runner "https://github.com/machacekmartin/twingo-notifier/blob/main/index.js"
click node_bazos "https://github.com/machacekmartin/twingo-notifier/blob/main/scrapers/bazoscz.js"
click node_sbazar "https://github.com/machacekmartin/twingo-notifier/blob/main/scrapers/sbazarcz.js"
click node_sauto "https://github.com/machacekmartin/twingo-notifier/blob/main/scrapers/sautocz.js"
click node_history "https://github.com/machacekmartin/twingo-notifier/blob/main/twingos.json"
click node_newoffers "https://github.com/machacekmartin/twingo-notifier/blob/main/index.js"
click node_historywrite "https://github.com/machacekmartin/twingo-notifier/blob/main/index.js"
click node_emailbody "https://github.com/machacekmartin/twingo-notifier/blob/main/index.js"
click node_emailfile "https://github.com/machacekmartin/twingo-notifier/blob/main/twingos-email.html"

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_bazos,node_sbazar,node_sauto toneBlue
class node_runner,node_history,node_newoffers,node_historywrite,node_emailbody,node_emailfile toneAmber
class node_scheduler,node_smtp,node_recipient toneIndigo
```

## Components

### Marketplace collection

- [Bazos scraper](https://github.com/machacekmartin/twingo-notifier/blob/main/scrapers/bazoscz.js): `scrapers/bazoscz.js`
- [Sbazar scraper](https://github.com/machacekmartin/twingo-notifier/blob/main/scrapers/sbazarcz.js): `scrapers/sbazarcz.js`
- [Sauto scraper](https://github.com/machacekmartin/twingo-notifier/blob/main/scrapers/sautocz.js): `scrapers/sautocz.js`

### Detection and output

- [Notifier runner](https://github.com/machacekmartin/twingo-notifier/blob/main/index.js): `index.js`
- [Offer history](https://github.com/machacekmartin/twingo-notifier/blob/main/twingos.json): `twingos.json`
- [New-offer detection](https://github.com/machacekmartin/twingo-notifier/blob/main/index.js): `index.js`
- [History update](https://github.com/machacekmartin/twingo-notifier/blob/main/index.js): `index.js`
- [Email body generation](https://github.com/machacekmartin/twingo-notifier/blob/main/index.js): `index.js`
- [Email body file](https://github.com/machacekmartin/twingo-notifier/blob/main/twingos-email.html): `twingos-email.html`

### Other components

- **Scheduled run**
- **SMTP mail service**
- **Configured recipient**

## Connections

- Scheduled run → Notifier runner: starts run (evidence: `README.md`)
- Notifier runner → Bazos scraper: scrapes listings (evidence: `index.js`)
- Notifier runner → Sbazar scraper: scrapes listings (evidence: `index.js`)
- Notifier runner → Sauto scraper: scrapes listings (evidence: `index.js`)
- Notifier runner → Offer history: reads (evidence: `index.js`)
- Notifier runner → New-offer detection: compares IDs (evidence: `index.js`)
- New-offer detection → History update: triggers update (evidence: `index.js`)
- History update → Offer history: appends offers (evidence: `index.js`)
- New-offer detection → Email body generation: triggers generation (evidence: `index.js`)
- Email body generation → Email body file: writes HTML (evidence: `index.js`)
- Email body file → SMTP mail service: sent by workflow (evidence: `README.md`)
- SMTP mail service → Configured recipient: emails alerts (evidence: `README.md`)
