# warutcha/twatched architecture

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

- Interactive diagram: https://gitdiagram.com/warutcha/twatched
- Repository: https://github.com/warutcha/twatched

## Overview

TWatched is a static, installable episode tracker. A user manages shows in the app; data is stored locally and can be synchronized across devices through a private GitHub repository. The app also checks for newly aired episodes and can notify the user. Offline app-shell caching supports use without a network connection. The README documents several capabilities whose implementation is inside the monolithic app.js; the available excerpts do not expose their internal call structure, so those relationships are shown only where documented.

Main entry points: [`app.js`](https://github.com/warutcha/twatched/blob/main/app.js) (App logic), [`sw.js`](https://github.com/warutcha/twatched/blob/main/sw.js) (Service worker), [`index.html`](https://github.com/warutcha/twatched/blob/main/index.html) (App shell), [`manifest.webmanifest`](https://github.com/warutcha/twatched/blob/main/manifest.webmanifest) (Install manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_shell["App shell<br/>[index.html]"]
  node_app["App logic<br/>[app.js]"]
end

subgraph group_tracking["Tracking features"]
  node_show_tracker["Episode tracking<br/>[app.js]"]
  node_show_library["Show library<br/>[app.js]"]
  node_poster_processing["Poster processing<br/>[app.js]"]
  node_episode_checks["Episode checks<br/>[app.js]"]
  node_notifications["Notifications<br/>[app.js]"]
end

subgraph group_persistence["Data and sync"]
  node_local_store[("Local storage<br/>[app.js]")]
  node_sync["Device sync<br/>[app.js]"]
end

subgraph group_platform["Install and offline"]
  node_service_worker["Service worker<br/>[sw.js]"]
  node_app_cache[("App-shell cache<br/>[sw.js]")]
  node_manifest["Install manifest"]
end

node_user(("App user"))
node_github_repo[("Private GitHub repo")]
node_device["Browser device"]
node_system_notifications["System notifications"]

node_user -->|"opens"| node_shell
node_shell -->|"runs logic"| node_app
node_user -->|"manages shows"| node_show_tracker
node_show_tracker -->|"updates library"| node_show_library
node_show_tracker -->|"stores data"| node_local_store
node_user -->|"adds photos"| node_poster_processing
node_poster_processing -->|"compresses posters"| node_show_library
node_app -->|"checks on open"| node_episode_checks
node_episode_checks -->|"alerts on episodes"| node_notifications
node_notifications -->|"notifies"| node_system_notifications
node_user -->|"configures sync"| node_sync
node_sync -->|"reads and writes"| node_github_repo
node_app -->|"uses offline support"| node_service_worker
node_service_worker -->|"caches app shell"| node_app_cache
node_service_worker -->|"handles fetches"| node_device
node_manifest -->|"enables installation"| node_device

click node_shell "https://github.com/warutcha/twatched/blob/main/index.html"
click node_app "https://github.com/warutcha/twatched/blob/main/app.js"
click node_show_tracker "https://github.com/warutcha/twatched/blob/main/app.js"
click node_show_library "https://github.com/warutcha/twatched/blob/main/app.js"
click node_poster_processing "https://github.com/warutcha/twatched/blob/main/app.js"
click node_episode_checks "https://github.com/warutcha/twatched/blob/main/app.js"
click node_notifications "https://github.com/warutcha/twatched/blob/main/app.js"
click node_local_store "https://github.com/warutcha/twatched/blob/main/app.js"
click node_sync "https://github.com/warutcha/twatched/blob/main/app.js"
click node_service_worker "https://github.com/warutcha/twatched/blob/main/sw.js"
click node_app_cache "https://github.com/warutcha/twatched/blob/main/sw.js"
click node_manifest "https://github.com/warutcha/twatched/blob/main/manifest.webmanifest"

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_shell,node_app,node_user,node_device toneBlue
class node_show_tracker,node_show_library,node_poster_processing,node_episode_checks,node_notifications,node_github_repo toneAmber
class node_local_store,node_sync toneMint
class node_service_worker,node_app_cache,node_manifest toneRose
class node_system_notifications toneIndigo
```

## Components

### App experience

- [App shell](https://github.com/warutcha/twatched/blob/main/index.html): `index.html`
- [App logic](https://github.com/warutcha/twatched/blob/main/app.js): `app.js`

### Tracking features

- [Episode tracking](https://github.com/warutcha/twatched/blob/main/app.js): `app.js`
- [Show library](https://github.com/warutcha/twatched/blob/main/app.js): `app.js`
- [Poster processing](https://github.com/warutcha/twatched/blob/main/app.js): `app.js`
- [Episode checks](https://github.com/warutcha/twatched/blob/main/app.js): `app.js`
- [Notifications](https://github.com/warutcha/twatched/blob/main/app.js): `app.js`

### Data and sync

- [Local storage](https://github.com/warutcha/twatched/blob/main/app.js): `app.js`
- [Device sync](https://github.com/warutcha/twatched/blob/main/app.js): `app.js`

### Install and offline

- [Service worker](https://github.com/warutcha/twatched/blob/main/sw.js): `sw.js`
- [App-shell cache](https://github.com/warutcha/twatched/blob/main/sw.js): `sw.js`
- [Install manifest](https://github.com/warutcha/twatched/blob/main/manifest.webmanifest): `manifest.webmanifest`

### Other components

- **App user**
- **Private GitHub repo**
- **Browser device**
- **System notifications**

## Connections

- App user → App shell: opens (evidence: `README.md`)
- App shell → App logic: runs logic (evidence: `README.md`)
- App user → Episode tracking: manages shows (evidence: `README.md`)
- Episode tracking → Show library: updates library (evidence: `README.md`)
- Episode tracking → Local storage: stores data (evidence: `README.md`)
- App user → Poster processing: adds photos (evidence: `README.md`)
- Poster processing → Show library: compresses posters (evidence: `README.md`)
- App logic → Episode checks: checks on open (evidence: `README.md`)
- Episode checks → Notifications: alerts on episodes (evidence: `README.md`)
- Notifications → System notifications: notifies (evidence: `README.md`)
- App user → Device sync: configures sync (evidence: `README.md`)
- Device sync → Private GitHub repo: reads and writes (evidence: `README.md`)
- App logic → Service worker: uses offline support (evidence: `README.md`)
- Service worker → App-shell cache: caches app shell (evidence: `sw.js`)
- Service worker → Browser device: handles fetches (evidence: `sw.js`)
- Install manifest → Browser device: enables installation (evidence: `README.md`)
