# koushikshety/anistream architecture

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

- Interactive diagram: https://gitdiagram.com/koushikshety/anistream
- Repository: https://github.com/koushikshety/anistream

## Overview

AniStream is a static anime and donghua discovery and viewing site, with scripts that assemble catalogs and official viewing links. The intended user journey is browsing a catalog and choosing an episode or official platform; `stream_switcher.js` implements matching and playback selection. The README is only a project name, and the page sources were not sampled, so page-to-player wiring and browsing behavior are not verified. The graph shows only explicit script reads, writes, and fetches; the YouTube validator’s integration is likewise not shown.

Main entry points: [`scripts/auto_sync.py`](https://github.com/koushikshety/anistream/blob/main/scripts/auto_sync.py) (Catalog discovery), [`stream_switcher.js`](https://github.com/koushikshety/anistream/blob/main/stream_switcher.js) (Stream switcher), [`merge_catalog.py`](https://github.com/koushikshety/anistream/blob/main/merge_catalog.py) (Catalog merger), [`episodes.json`](https://github.com/koushikshety/anistream/blob/main/episodes.json) (Episode data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_site["Site and playback"]
  node_home["Catalog page<br/>[index.html]"]
  node_watch["Watch page<br/>[watch.html]"]
  node_admin["Admin page<br/>[admin.html]"]
  node_switcher["Stream switcher<br/>[stream_switcher.js]"]
end

subgraph group_catalog["Catalog generation"]
  node_catalog_json[("Unified catalog<br/>[catalog.json]")]
  node_anime_json[("Anime catalog<br/>[anime_catalog.json]")]
  node_donghua_json[("Donghua catalog")]
  node_auto_sync["Catalog discovery<br/>[auto_sync.py]"]
  node_merge["Catalog merger<br/>[merge_catalog.py]"]
end

subgraph group_sources["Media sources"]
  node_watch_sync["Licensed links sync"]
  node_youtube_sync["YouTube feed sync<br/>[sync_youtube.py]"]
  node_validator["Video validator"]
  node_episodes[("Episode data<br/>[episodes.json]")]
  node_watch_links[("Licensed link data<br/>[watch_links.json]")]
end

node_viewer(("Viewer"))
node_anilist{{"AniList"}}
node_youtube{{"YouTube"}}
node_dailymotion{{"Dailymotion"}}
node_community{{"Community feed"}}

node_viewer -.->|"browses"| node_home
node_viewer -.->|"watches"| node_watch
node_auto_sync -->|"fetches metadata"| node_anilist
node_auto_sync -->|"scans feeds"| node_youtube
node_auto_sync -->|"fetches videos"| node_dailymotion
node_auto_sync -->|"writes"| node_catalog_json
node_auto_sync -->|"writes"| node_anime_json
node_auto_sync -->|"writes"| node_donghua_json
node_watch_sync -->|"queries links"| node_anilist
node_watch_sync -->|"writes"| node_watch_links
node_youtube_sync -->|"resolves feeds"| node_youtube
node_youtube_sync -->|"writes"| node_episodes
node_merge -->|"reads and writes"| node_catalog_json
node_merge -->|"reads"| node_episodes
node_merge -->|"reads"| node_watch_links
node_switcher -->|"loads"| node_episodes
node_switcher -->|"loads"| node_watch_links
node_switcher -->|"fetches feed"| node_community
node_validator -.->|"validates video data"| node_youtube

click node_home "https://github.com/koushikshety/anistream/blob/main/index.html"
click node_watch "https://github.com/koushikshety/anistream/blob/main/watch.html"
click node_admin "https://github.com/koushikshety/anistream/blob/main/admin.html"
click node_switcher "https://github.com/koushikshety/anistream/blob/main/stream_switcher.js"
click node_catalog_json "https://github.com/koushikshety/anistream/blob/main/data/catalog.json"
click node_anime_json "https://github.com/koushikshety/anistream/blob/main/data/anime_catalog.json"
click node_donghua_json "https://github.com/koushikshety/anistream/blob/main/data/donghua_catalog.json"
click node_auto_sync "https://github.com/koushikshety/anistream/blob/main/scripts/auto_sync.py"
click node_merge "https://github.com/koushikshety/anistream/blob/main/merge_catalog.py"
click node_watch_sync "https://github.com/koushikshety/anistream/blob/main/sync_watch_links.py"
click node_youtube_sync "https://github.com/koushikshety/anistream/blob/main/sync_youtube.py"
click node_validator "https://github.com/koushikshety/anistream/blob/main/youtube_validator.py"
click node_episodes "https://github.com/koushikshety/anistream/blob/main/episodes.json"
click node_watch_links "https://github.com/koushikshety/anistream/blob/main/watch_links.json"

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_home,node_watch,node_admin,node_switcher,node_viewer toneBlue
class node_catalog_json,node_anime_json,node_donghua_json,node_auto_sync,node_merge toneAmber
class node_watch_sync,node_youtube_sync,node_validator,node_episodes,node_watch_links toneMint
class node_anilist,node_youtube,node_dailymotion,node_community toneIndigo
```

## Components

### Site and playback

- [Catalog page](https://github.com/koushikshety/anistream/blob/main/index.html): `index.html`
- [Watch page](https://github.com/koushikshety/anistream/blob/main/watch.html): `watch.html`
- [Admin page](https://github.com/koushikshety/anistream/blob/main/admin.html): `admin.html`
- [Stream switcher](https://github.com/koushikshety/anistream/blob/main/stream_switcher.js): `stream_switcher.js`

### Catalog generation

- [Unified catalog](https://github.com/koushikshety/anistream/blob/main/data/catalog.json): `data/catalog.json`
- [Anime catalog](https://github.com/koushikshety/anistream/blob/main/data/anime_catalog.json): `data/anime_catalog.json`
- [Donghua catalog](https://github.com/koushikshety/anistream/blob/main/data/donghua_catalog.json): `data/donghua_catalog.json`
- [Catalog discovery](https://github.com/koushikshety/anistream/blob/main/scripts/auto_sync.py): `scripts/auto_sync.py`
- [Catalog merger](https://github.com/koushikshety/anistream/blob/main/merge_catalog.py): `merge_catalog.py`

### Media sources

- [Licensed links sync](https://github.com/koushikshety/anistream/blob/main/sync_watch_links.py): `sync_watch_links.py`
- [YouTube feed sync](https://github.com/koushikshety/anistream/blob/main/sync_youtube.py): `sync_youtube.py`
- [Video validator](https://github.com/koushikshety/anistream/blob/main/youtube_validator.py): `youtube_validator.py`
- [Episode data](https://github.com/koushikshety/anistream/blob/main/episodes.json): `episodes.json`
- [Licensed link data](https://github.com/koushikshety/anistream/blob/main/watch_links.json): `watch_links.json`

### Other components

- **Viewer**
- **AniList**
- **YouTube**
- **Dailymotion**
- **Community feed**

## Connections

- Viewer → Catalog page: browses
- Viewer → Watch page: watches
- Catalog discovery → AniList: fetches metadata (evidence: `scripts/auto_sync.py`)
- Catalog discovery → YouTube: scans feeds (evidence: `scripts/auto_sync.py`)
- Catalog discovery → Dailymotion: fetches videos (evidence: `scripts/auto_sync.py`)
- Catalog discovery → Unified catalog: writes (evidence: `scripts/auto_sync.py`)
- Catalog discovery → Anime catalog: writes (evidence: `scripts/auto_sync.py`)
- Catalog discovery → Donghua catalog: writes (evidence: `scripts/auto_sync.py`)
- Licensed links sync → AniList: queries links (evidence: `sync_watch_links.py`)
- Licensed links sync → Licensed link data: writes (evidence: `sync_watch_links.py`)
- YouTube feed sync → YouTube: resolves feeds (evidence: `sync_youtube.py`)
- YouTube feed sync → Episode data: writes (evidence: `sync_youtube.py`)
- Catalog merger → Unified catalog: reads and writes (evidence: `merge_catalog.py`)
- Catalog merger → Episode data: reads (evidence: `merge_catalog.py`)
- Catalog merger → Licensed link data: reads (evidence: `merge_catalog.py`)
- Stream switcher → Episode data: loads (evidence: `stream_switcher.js`)
- Stream switcher → Licensed link data: loads (evidence: `stream_switcher.js`)
- Stream switcher → Community feed: fetches feed (evidence: `stream_switcher.js`)
- Video validator → YouTube: validates video data
