# vitalets/github-trending-repos architecture

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

- Interactive diagram: https://gitdiagram.com/vitalets/github-trending-repos
- Repository: https://github.com/vitalets/github-trending-repos

## Overview

This repository delivers GitHub trending-repository notifications through language-specific GitHub issues. The principal workflow fetches labeled issues, reads each issue’s trending URL, discovers new repositories, and posts a comment for subscribers; a separate maintenance workflow removes old comments. The README also documents daily/weekly schedules and language subscriptions. Relationships among the sampled modules are supported by their excerpts or SOURCE INDEX references; language-list management is represented from the tree and README, so its internal wiring is not asserted.

Main entry points: [`scripts/helpers/issue-updater.js`](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/issue-updater.js) (Issue updater), [`scripts/update-issues.js`](https://github.com/vitalets/github-trending-repos/blob/master/scripts/update-issues.js) (Update issues), [`scripts/clean-issues.js`](https://github.com/vitalets/github-trending-repos/blob/master/scripts/clean-issues.js) (Clean issues), [`scripts/helpers/comments.js`](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/comments.js) (Issue comments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflows["Scheduled workflows"]
  node_update_job["Update issues<br/>[update-issues.js]"]
  node_clean_job["Clean issues<br/>[clean-issues.js]"]
  node_language_management["Language subscriptions"]
  node_issue_updater["Issue updater<br/>[issue-updater.js]"]
  node_issue_cleaner["Comment cleanup<br/>[issue-cleaner.js]"]
end

subgraph group_github["GitHub issue access"]
  node_issues["Issue selection<br/>[issues.js]"]
  node_comments["Issue comments<br/>[comments.js]"]
  node_github_api["GitHub API client<br/>[github-api.js]"]
end

subgraph group_trending["Trend processing"]
  node_trends["Trend scraper<br/>[trends.js]"]
  node_translator["Description translation<br/>[translator.js]"]
end

subgraph group_support["Runtime support"]
  node_artifacts["Failure artifacts<br/>[artifacts.js]"]
  node_config["Runtime configuration<br/>[config.js]"]
  node_reporter["Run reporting<br/>[reporter.js]"]
  node_stats["Run statistics<br/>[stat.js]"]
  node_logger["Logging<br/>[logger.js]"]
end

node_scheduler(("Daily/weekly schedule"))
node_github[("GitHub issues")]
node_github_trending["GitHub Trending"]
node_subscribers(("Issue subscribers"))

node_scheduler -->|"schedules daily/weekly"| node_update_job
node_scheduler -.->|"runs maintenance"| node_clean_job
node_update_job -->|"loads issues"| node_issues
node_update_job -->|"updates each"| node_issue_updater
node_clean_job -->|"loads issues"| node_issues
node_clean_job -->|"cleans each"| node_issue_cleaner
node_issues -->|"fetches issues"| node_github_api
node_github_api -->|"calls API"| node_github
node_issue_updater -->|"extracts trend URL"| node_issues
node_issue_updater -->|"fetches trends"| node_trends
node_trends -->|"scrapes page"| node_github_trending
node_issue_updater -->|"reads and posts"| node_comments
node_issue_updater -->|"translates descriptions"| node_translator
node_issue_cleaner -->|"reads and deletes"| node_comments
node_comments -->|"requests comments"| node_github_api
node_comments -->|"reads and writes"| node_github
node_trends -->|"saves failed pages"| node_artifacts
node_update_job -->|"reports run"| node_reporter
node_clean_job -->|"reports run"| node_reporter
node_reporter -->|"reports counters"| node_stats
node_subscribers -->|"subscribes to issues"| node_github
node_language_management -.->|"maintains language issues"| node_github

click node_update_job "https://github.com/vitalets/github-trending-repos/blob/master/scripts/update-issues.js"
click node_clean_job "https://github.com/vitalets/github-trending-repos/blob/master/scripts/clean-issues.js"
click node_language_management "https://github.com/vitalets/github-trending-repos/tree/master/scripts"
click node_issues "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/issues.js"
click node_issue_updater "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/issue-updater.js"
click node_issue_cleaner "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/issue-cleaner.js"
click node_comments "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/comments.js"
click node_github_api "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/github-api.js"
click node_trends "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/trends.js"
click node_translator "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/translator.js"
click node_artifacts "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/artifacts.js"
click node_config "https://github.com/vitalets/github-trending-repos/blob/master/scripts/config.js"
click node_reporter "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/reporter.js"
click node_stats "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/stat.js"
click node_logger "https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/logger.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_update_job,node_clean_job,node_language_management,node_issue_updater,node_issue_cleaner toneBlue
class node_issues,node_comments,node_github_api,node_github toneAmber
class node_trends,node_translator toneMint
class node_artifacts,node_config,node_reporter,node_stats,node_logger toneRose
class node_scheduler,node_github_trending,node_subscribers toneIndigo
```

## Components

### Scheduled workflows

- [Update issues](https://github.com/vitalets/github-trending-repos/blob/master/scripts/update-issues.js): `scripts/update-issues.js`
- [Clean issues](https://github.com/vitalets/github-trending-repos/blob/master/scripts/clean-issues.js): `scripts/clean-issues.js`
- [Language subscriptions](https://github.com/vitalets/github-trending-repos/tree/master/scripts): `scripts`
- [Issue updater](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/issue-updater.js): `scripts/helpers/issue-updater.js`
- [Comment cleanup](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/issue-cleaner.js): `scripts/helpers/issue-cleaner.js`

### GitHub issue access

- [Issue selection](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/issues.js): `scripts/helpers/issues.js`
- [Issue comments](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/comments.js): `scripts/helpers/comments.js`
- [GitHub API client](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/github-api.js): `scripts/helpers/github-api.js`

### Trend processing

- [Trend scraper](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/trends.js): `scripts/helpers/trends.js`
- [Description translation](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/translator.js): `scripts/helpers/translator.js`

### Runtime support

- [Failure artifacts](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/artifacts.js): `scripts/helpers/artifacts.js`
- [Runtime configuration](https://github.com/vitalets/github-trending-repos/blob/master/scripts/config.js): `scripts/config.js`
- [Run reporting](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/reporter.js): `scripts/helpers/reporter.js`
- [Run statistics](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/stat.js): `scripts/helpers/stat.js`
- [Logging](https://github.com/vitalets/github-trending-repos/blob/master/scripts/helpers/logger.js): `scripts/helpers/logger.js`

### Other components

- **Daily/weekly schedule**
- **GitHub issues**
- **GitHub Trending**
- **Issue subscribers**

## Connections

- Daily/weekly schedule → Update issues: schedules daily/weekly (evidence: `README.md`)
- Daily/weekly schedule → Clean issues: runs maintenance
- Update issues → Issue selection: loads issues (evidence: `scripts/update-issues.js`)
- Update issues → Issue updater: updates each (evidence: `scripts/update-issues.js`)
- Clean issues → Issue selection: loads issues (evidence: `scripts/clean-issues.js`)
- Clean issues → Comment cleanup: cleans each (evidence: `scripts/clean-issues.js`)
- Issue selection → GitHub API client: fetches issues (evidence: `scripts/helpers/issues.js`)
- GitHub API client → GitHub issues: calls API (evidence: `scripts/helpers/github-api.js`)
- Issue updater → Issue selection: extracts trend URL (evidence: `scripts/helpers/issue-updater.js`)
- Issue updater → Trend scraper: fetches trends (evidence: `scripts/helpers/issue-updater.js`)
- Trend scraper → GitHub Trending: scrapes page (evidence: `scripts/helpers/trends.js`)
- Issue updater → Issue comments: reads and posts (evidence: `scripts/helpers/issue-updater.js`)
- Issue updater → Description translation: translates descriptions (evidence: `scripts/helpers/issue-updater.js`)
- Comment cleanup → Issue comments: reads and deletes (evidence: `scripts/helpers/issue-cleaner.js`)
- Issue comments → GitHub API client: requests comments (evidence: `scripts/helpers/comments.js`)
- Issue comments → GitHub issues: reads and writes (evidence: `README.md`)
- Trend scraper → Failure artifacts: saves failed pages (evidence: `scripts/helpers/trends.js`)
- Update issues → Run reporting: reports run (evidence: `scripts/update-issues.js`)
- Clean issues → Run reporting: reports run (evidence: `scripts/clean-issues.js`)
- Run reporting → Run statistics: reports counters (evidence: `scripts/helpers/reporter.js`)
- Issue subscribers → GitHub issues: subscribes to issues (evidence: `README.md`)
- Language subscriptions → GitHub issues: maintains language issues
