# nathan-pro-fr/discord_github_action architecture

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

- Interactive diagram: https://gitdiagram.com/nathan-pro-fr/discord_github_action
- Repository: https://github.com/nathan-pro-fr/discord_github_action

## Overview

Discord Media Gallery is a static image/video gallery whose dataset is refreshed from a Discord channel by an automated or manually triggered sync. The workflow coordinates collection, statistics, and success or failure notifications; the browser loads the generated JSON and renders media with a modal. A service worker adds caching for the site shell and prioritizes fresh gallery data. Workflow relationships are based on the README’s documented sequence; the workflow file and page markup were not sampled, so their internal wiring is not independently verified.

Main entry points: [`.github/workflows/sync_discord.yml`](https://github.com/nathan-pro-fr/discord_github_action/blob/main/.github/workflows/sync_discord.yml) (Sync workflow), [`donnees.json`](https://github.com/nathan-pro-fr/discord_github_action/blob/main/donnees.json) (Media URL dataset), [`recupere_medias.js`](https://github.com/nathan-pro-fr/discord_github_action/blob/main/recupere_medias.js) (Discord collector), [`index.html`](https://github.com/nathan-pro-fr/discord_github_action/blob/main/index.html) (Gallery page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_automation["Sync automation"]
  node_workflow["Sync workflow<br/>[sync_discord.yml]"]
  node_collector["Discord collector<br/>[recupere_medias.js]"]
  node_stats["Sync statistics<br/>[calcul_stats.js]"]
end

subgraph group_data["Media data"]
  node_dataset["Media URL dataset<br/>[donnees.json]"]
end

subgraph group_frontend["Gallery frontend"]
  node_gallery_page["Gallery page<br/>[index.html]"]
  node_renderer["Media renderer<br/>[script.js]"]
  node_styles["Gallery styling<br/>[style.css]"]
  node_service_worker["Cache handler<br/>[sw.js]"]
end

subgraph group_notifications["Notifications"]
  node_webhook_sender["Sync notifier<br/>[envoi_webhook.js]"]
  node_failure_notifier["Failure alert<br/>[notif_erreur_mp.js]"]
end

node_visitor(("Gallery visitor"))
node_discord_channel["Discord channel API"]
node_discord_webhook["Discord webhook"]
node_discord_dm["Discord direct messages"]

node_workflow -->|"runs sync"| node_collector
node_collector -->|"fetches messages"| node_discord_channel
node_collector -->|"writes URLs"| node_dataset
node_workflow -->|"runs stats"| node_stats
node_stats -->|"compares data"| node_dataset
node_workflow -->|"runs notifier"| node_webhook_sender
node_webhook_sender -->|"posts summary"| node_discord_webhook
node_workflow -->|"alerts on failure"| node_failure_notifier
node_failure_notifier -->|"sends alert"| node_discord_dm
node_visitor -.->|"opens gallery"| node_gallery_page
node_gallery_page -->|"loads frontend"| node_renderer
node_renderer -->|"fetches URLs"| node_dataset
node_gallery_page -.->|"uses styling"| node_styles
node_service_worker -->|"caches data"| node_dataset

click node_workflow "https://github.com/nathan-pro-fr/discord_github_action/blob/main/.github/workflows/sync_discord.yml"
click node_collector "https://github.com/nathan-pro-fr/discord_github_action/blob/main/recupere_medias.js"
click node_stats "https://github.com/nathan-pro-fr/discord_github_action/blob/main/calcul_stats.js"
click node_dataset "https://github.com/nathan-pro-fr/discord_github_action/blob/main/donnees.json"
click node_gallery_page "https://github.com/nathan-pro-fr/discord_github_action/blob/main/index.html"
click node_renderer "https://github.com/nathan-pro-fr/discord_github_action/blob/main/script.js"
click node_styles "https://github.com/nathan-pro-fr/discord_github_action/blob/main/css/style.css"
click node_service_worker "https://github.com/nathan-pro-fr/discord_github_action/blob/main/sw.js"
click node_webhook_sender "https://github.com/nathan-pro-fr/discord_github_action/blob/main/envoi_webhook.js"
click node_failure_notifier "https://github.com/nathan-pro-fr/discord_github_action/blob/main/notif_erreur_mp.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_workflow,node_collector,node_stats toneBlue
class node_dataset toneAmber
class node_gallery_page,node_renderer,node_styles,node_service_worker,node_discord_channel,node_discord_webhook toneMint
class node_webhook_sender,node_failure_notifier toneRose
class node_visitor,node_discord_dm toneIndigo
```

## Components

### Sync automation

- [Sync workflow](https://github.com/nathan-pro-fr/discord_github_action/blob/main/.github/workflows/sync_discord.yml): `.github/workflows/sync_discord.yml`
- [Discord collector](https://github.com/nathan-pro-fr/discord_github_action/blob/main/recupere_medias.js): `recupere_medias.js`
- [Sync statistics](https://github.com/nathan-pro-fr/discord_github_action/blob/main/calcul_stats.js): `calcul_stats.js`

### Media data

- [Media URL dataset](https://github.com/nathan-pro-fr/discord_github_action/blob/main/donnees.json): `donnees.json`

### Gallery frontend

- [Gallery page](https://github.com/nathan-pro-fr/discord_github_action/blob/main/index.html): `index.html`
- [Media renderer](https://github.com/nathan-pro-fr/discord_github_action/blob/main/script.js): `script.js`
- [Gallery styling](https://github.com/nathan-pro-fr/discord_github_action/blob/main/css/style.css): `css/style.css`
- [Cache handler](https://github.com/nathan-pro-fr/discord_github_action/blob/main/sw.js): `sw.js`

### Notifications

- [Sync notifier](https://github.com/nathan-pro-fr/discord_github_action/blob/main/envoi_webhook.js): `envoi_webhook.js`
- [Failure alert](https://github.com/nathan-pro-fr/discord_github_action/blob/main/notif_erreur_mp.js): `notif_erreur_mp.js`

### Other components

- **Gallery visitor**
- **Discord channel API**
- **Discord webhook**
- **Discord direct messages**

## Connections

- Sync workflow → Discord collector: runs sync (evidence: `README.md`)
- Discord collector → Discord channel API: fetches messages (evidence: `recupere_medias.js`)
- Discord collector → Media URL dataset: writes URLs (evidence: `recupere_medias.js`)
- Sync workflow → Sync statistics: runs stats (evidence: `README.md`)
- Sync statistics → Media URL dataset: compares data (evidence: `calcul_stats.js`)
- Sync workflow → Sync notifier: runs notifier (evidence: `README.md`)
- Sync notifier → Discord webhook: posts summary (evidence: `envoi_webhook.js`)
- Sync workflow → Failure alert: alerts on failure (evidence: `README.md`)
- Failure alert → Discord direct messages: sends alert (evidence: `notif_erreur_mp.js`)
- Gallery visitor → Gallery page: opens gallery
- Gallery page → Media renderer: loads frontend (evidence: `README.md`)
- Media renderer → Media URL dataset: fetches URLs (evidence: `script.js`)
- Gallery page → Gallery styling: uses styling
- Cache handler → Media URL dataset: caches data (evidence: `sw.js`)
