# hypnoticdo0g/rss-chan architecture

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

- Interactive diagram: https://gitdiagram.com/hypnoticdo0g/rss-chan
- Repository: https://github.com/hypnoticdo0g/rss-chan

## Overview

rss-chan is a self-hosted Telegram bot that monitors RSS subscriptions and posts new items to a configured chat. The main workflow starts the bot, registers owner-filtered commands, loads subscription state, then periodically checks feeds, formats new entries, and sends them to Telegram. Users can also list, fetch, subscribe, unsubscribe, and set per-feed templates. The excerpts show command, storage, formatting, and scheduling links; unsampled command details are represented at the handler-module level.

Main entry points: [`bot/modules/rsshandler.py`](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/rsshandler.py) (RSS commands), [`bot/__main__.py`](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/__main__.py) (Bot startup), [`bot/modules/dbhandler.py`](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/dbhandler.py) (PostgreSQL storage), [`bot/modules/utilhandler.py`](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/utilhandler.py) (Template formatter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_main["Bot startup<br/>[__main__.py]"]
  node_config["Bot configuration<br/>[__init__.py]"]
end

subgraph group_feeds["Feed operations"]
  node_commands["RSS commands<br/>[rsshandler.py]"]
  node_monitor["Feed monitor<br/>[rsshandler.py]"]
  node_parser["Feed parser"]
  node_formatter["Template formatter<br/>[utilhandler.py]"]
end

subgraph group_state["Subscription state"]
  node_postgres[("PostgreSQL storage<br/>[dbhandler.py]")]
  node_cache["Subscription cache<br/>[dbhandler.py]"]
end

subgraph group_delivery["Message delivery"]
  node_telegram["Telegram API"]
end

node_user(("Bot user"))

node_main -->|"initializes"| node_commands
node_main -->|"uses updater"| node_config
node_main -->|"starts polling"| node_telegram
node_user -.->|"sends commands"| node_telegram
node_telegram -->|"dispatches"| node_commands
node_commands -->|"reads and writes"| node_postgres
node_commands -->|"parses feeds"| node_parser
node_commands -.->|"formats items"| node_formatter
node_commands -->|"lists subscriptions"| node_cache
node_commands -->|"schedules"| node_monitor
node_monitor -->|"parses feeds"| node_parser
node_monitor -->|"formats entries"| node_formatter
node_monitor -->|"updates item state"| node_postgres
node_monitor -->|"sends posts"| node_telegram
node_postgres -->|"reloads"| node_cache

click node_main "https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/__main__.py"
click node_config "https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/__init__.py"
click node_commands "https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/rsshandler.py"
click node_monitor "https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/rsshandler.py"
click node_formatter "https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/utilhandler.py"
click node_postgres "https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/dbhandler.py"
click node_cache "https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/dbhandler.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_main,node_config,node_user toneBlue
class node_commands,node_monitor,node_parser,node_formatter toneAmber
class node_postgres,node_cache toneMint
class node_telegram toneRose
```

## Components

### Bot runtime

- [Bot startup](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/__main__.py): `bot/__main__.py`
- [Bot configuration](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/__init__.py): `bot/__init__.py`

### Feed operations

- [RSS commands](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/rsshandler.py): `bot/modules/rsshandler.py`
- [Feed monitor](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/rsshandler.py): `bot/modules/rsshandler.py`
- **Feed parser**
- [Template formatter](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/utilhandler.py): `bot/modules/utilhandler.py`

### Subscription state

- [PostgreSQL storage](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/dbhandler.py): `bot/modules/dbhandler.py`
- [Subscription cache](https://github.com/hypnoticdo0g/rss-chan/blob/main/bot/modules/dbhandler.py): `bot/modules/dbhandler.py`

### Message delivery

- **Telegram API**

### Other components

- **Bot user**

## Connections

- Bot startup → RSS commands: initializes (evidence: `bot/__main__.py`)
- Bot startup → Bot configuration: uses updater (evidence: `bot/__main__.py`)
- Bot startup → Telegram API: starts polling (evidence: `bot/__main__.py`)
- Bot user → Telegram API: sends commands (evidence: `README.md`)
- Telegram API → RSS commands: dispatches (evidence: `bot/modules/rsshandler.py`)
- RSS commands → PostgreSQL storage: reads and writes (evidence: `bot/modules/rsshandler.py`)
- RSS commands → Feed parser: parses feeds (evidence: `bot/modules/rsshandler.py`)
- RSS commands → Template formatter: formats items (evidence: `bot/modules/rsshandler.py`)
- RSS commands → Subscription cache: lists subscriptions (evidence: `bot/modules/rsshandler.py`)
- RSS commands → Feed monitor: schedules (evidence: `bot/modules/rsshandler.py`)
- Feed monitor → Feed parser: parses feeds (evidence: `bot/modules/rsshandler.py`)
- Feed monitor → Template formatter: formats entries (evidence: `bot/modules/rsshandler.py`)
- Feed monitor → PostgreSQL storage: updates item state (evidence: `bot/modules/rsshandler.py`)
- Feed monitor → Telegram API: sends posts (evidence: `bot/modules/rsshandler.py`)
- PostgreSQL storage → Subscription cache: reloads (evidence: `bot/modules/dbhandler.py`)
