# sitremas/hlidaci-pes architecture

> Architecture diagram of the GitHub repository sitremas/hlidaci-pes, 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/sitremas/hlidaci-pes
- Repository: https://github.com/sitremas/hlidaci-pes

## Overview

This is a Flask TicketSwap listing monitor. Users preview an event, add it with an optional price limit, and view or deactivate tracked events and their notification history. A scheduled check fetches listings, applies the limit, records qualifying notifications, and sends Telegram messages. The excerpt shows these responsibilities concentrated in app.py; omitted sections prevent confirming some route and database details, so the graph avoids unsupported links.

Main entry points: [`app.py`](https://github.com/sitremas/hlidaci-pes/blob/main/app.py) (Event checker), [`templates/index.html`](https://github.com/sitremas/hlidaci-pes/blob/main/templates/index.html) (Event UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_ui["Event UI<br/>[index.html]"]
  node_flask["Flask routes<br/>[app.py]"]
  node_preview["Event preview<br/>[app.py]"]
end

subgraph group_monitor["Listing monitor"]
  node_scheduler["Scheduled checks<br/>[app.py]"]
  node_checker["Event checker<br/>[app.py]"]
  node_fetcher["Listing fetcher<br/>[app.py]"]
  node_filter["Price qualification<br/>[app.py]"]
end

subgraph group_state["Tracking state"]
  node_events[("Tracked events<br/>[app.py]")]
  node_notifications[("Notification history<br/>[app.py]")]
end

subgraph group_notify["Notifications"]
  node_telegram_sender["Telegram sender<br/>[app.py]"]
end

node_user(("User"))
node_ticketswap{{"TicketSwap API"}}
node_telegram{{"Telegram API"}}

node_user -.->|"uses"| node_ui
node_ui -.->|"calls API"| node_flask
node_flask -->|"routes preview"| node_preview
node_preview -->|"fetches listings"| node_fetcher
node_scheduler -->|"runs every five minutes"| node_checker
node_checker -->|"reads events"| node_events
node_checker -->|"fetches listings"| node_fetcher
node_fetcher -->|"requests data"| node_ticketswap
node_checker -->|"checks price"| node_filter
node_checker -->|"sends qualifying alerts"| node_telegram_sender
node_checker -->|"records alerts"| node_notifications
node_telegram_sender -->|"posts message"| node_telegram
node_flask -->|"manages events"| node_events
node_flask -.->|"reads history"| node_notifications

click node_ui "https://github.com/sitremas/hlidaci-pes/blob/main/templates/index.html"
click node_flask "https://github.com/sitremas/hlidaci-pes/blob/main/app.py"
click node_preview "https://github.com/sitremas/hlidaci-pes/blob/main/app.py"
click node_scheduler "https://github.com/sitremas/hlidaci-pes/blob/main/app.py"
click node_checker "https://github.com/sitremas/hlidaci-pes/blob/main/app.py"
click node_fetcher "https://github.com/sitremas/hlidaci-pes/blob/main/app.py"
click node_events "https://github.com/sitremas/hlidaci-pes/blob/main/app.py"
click node_notifications "https://github.com/sitremas/hlidaci-pes/blob/main/app.py"
click node_filter "https://github.com/sitremas/hlidaci-pes/blob/main/app.py"
click node_telegram_sender "https://github.com/sitremas/hlidaci-pes/blob/main/app.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_ui,node_flask,node_preview,node_user toneBlue
class node_scheduler,node_checker,node_fetcher,node_filter toneAmber
class node_events,node_notifications,node_ticketswap,node_telegram toneMint
class node_telegram_sender toneRose
```

## Components

### Web interface

- [Event UI](https://github.com/sitremas/hlidaci-pes/blob/main/templates/index.html): `templates/index.html`
- [Flask routes](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`
- [Event preview](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`

### Listing monitor

- [Scheduled checks](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`
- [Event checker](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`
- [Listing fetcher](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`
- [Price qualification](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`

### Tracking state

- [Tracked events](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`
- [Notification history](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`

### Notifications

- [Telegram sender](https://github.com/sitremas/hlidaci-pes/blob/main/app.py): `app.py`

### Other components

- **User**
- **TicketSwap API**
- **Telegram API**

## Connections

- User → Event UI: uses
- Event UI → Flask routes: calls API
- Flask routes → Event preview: routes preview (evidence: `app.py`)
- Event preview → Listing fetcher: fetches listings (evidence: `app.py`)
- Scheduled checks → Event checker: runs every five minutes (evidence: `app.py`)
- Event checker → Tracked events: reads events (evidence: `app.py`)
- Event checker → Listing fetcher: fetches listings (evidence: `app.py`)
- Listing fetcher → TicketSwap API: requests data (evidence: `app.py`)
- Event checker → Price qualification: checks price (evidence: `app.py`)
- Event checker → Telegram sender: sends qualifying alerts (evidence: `app.py`)
- Event checker → Notification history: records alerts (evidence: `app.py`)
- Telegram sender → Telegram API: posts message (evidence: `app.py`)
- Flask routes → Tracked events: manages events (evidence: `app.py`)
- Flask routes → Notification history: reads history (evidence: `app.py`)
