# troubledkiller69-lgtm/alexandria architecture

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

- Interactive diagram: https://gitdiagram.com/troubledkiller69-lgtm/alexandria
- Repository: https://github.com/troubledkiller69-lgtm/alexandria

## Overview

Alexandria is a browser-based streaming discovery, watch-diary, and social app, usable locally without an account and with cloud-backed features after sign-in. The main journey is to discover a title, inspect its details, play it, and record progress or a rating; accounts add sync and community features. The graph preserves major README capabilities, including parties, shared lists, franchises, anime, and profiles. Source excerpts establish app composition and several API calls; dashed links mark documented features whose wiring was not shown.

Main entry points: [`js/app.js`](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/app.js) (App Composition), [`js/storage.js`](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/storage.js) (Watch Diary), [`api/anime.js`](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/anime.js) (Anime Mapping), [`js/player.js`](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/player.js) (Media Player)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["App Shell &amp; Discovery"]
  node_app["App Composition<br/>[app.js]"]
  node_router["Navigation<br/>[router.js]"]
  node_home["Home Discovery<br/>[home.js]"]
  node_browse["Browse<br/>[browse.js]"]
  node_search["Search &amp; Roulette<br/>[search.js]"]
  node_details["Title Details<br/>[details.js]"]
  node_franchises["Franchise Archives<br/>[franchises.js]"]
  node_anime["Anime Mapping<br/>[anime.js]"]
  node_core["Shared Runtime<br/>[core.js]"]
  node_views["View Rendering<br/>[views.js]"]
end

subgraph group_diary["Library &amp; Profiles"]
  node_storage["Watch Diary<br/>[storage.js]"]
  node_settings["Import &amp; Settings<br/>[settings.js]"]
  node_profiles["Profiles &amp; Stats<br/>[profiles.js]"]
  node_auth["Account Access<br/>[auth.js]"]
end

subgraph group_watching["Playback &amp; Parties"]
  node_player["Media Player<br/>[player.js]"]
  node_party["Watch Parties<br/>[party.js]"]
end

subgraph group_social["Community &amp; Sharing"]
  node_comments["Title Comments<br/>[comments.js]"]
  node_community["Community Feed<br/>[community.js]"]
  node_sharedlists["Shared Lists<br/>[sharedlists.js]"]
  node_shareapi["Share Cards<br/>[share.js]"]
end

subgraph group_services["API &amp; Data Services"]
  node_proxy["TMDB Proxy<br/>[proxy.js]"]
  node_rate["Rate Limiter<br/>[_ratelimit.js]"]
end

node_viewer(("Viewer"))
node_tmdb{{"TMDB"}}
node_anilist{{"AniList"}}
node_supabase[("Supabase")]
node_browser[("Browser Storage")]
node_mirrors{{"Streaming Mirrors"}}

node_viewer -->|"uses"| node_app
node_app -->|"composes"| node_core
node_app -->|"composes"| node_router
node_app -->|"composes"| node_home
node_app -->|"composes"| node_browse
node_app -->|"composes"| node_search
node_app -->|"composes"| node_details
node_app -->|"composes"| node_franchises
node_app -->|"composes"| node_anime
node_app -->|"composes"| node_storage
node_app -->|"composes"| node_settings
node_app -->|"composes"| node_profiles
node_app -->|"composes"| node_player
node_app -->|"composes"| node_party
node_app -->|"composes"| node_comments
node_app -->|"composes"| node_community
node_app -->|"composes"| node_sharedlists
node_app -->|"composes"| node_auth
node_app -->|"composes"| node_views
node_core -->|"fetches titles"| node_proxy
node_proxy -->|"requests metadata"| node_tmdb
node_proxy -->|"checks limits"| node_rate
node_anime -->|"searches titles"| node_anilist
node_anime -->|"reads mappings"| node_supabase
node_anime -->|"checks limits"| node_rate
node_shareapi -->|"loads metadata"| node_tmdb
node_shareapi -->|"loads share data"| node_supabase
node_shareapi -->|"checks limits"| node_rate
node_storage -->|"stores diary"| node_browser
node_storage -->|"syncs diary"| node_supabase
node_profiles -->|"loads profile data"| node_supabase
node_router -->|"routes playback"| node_player
node_router -->|"routes details"| node_details
node_player -.->|"selects streams"| node_mirrors
node_party -.->|"syncs playback"| node_player
node_party -.->|"coordinates rooms"| node_supabase
node_auth -.->|"authenticates accounts"| node_supabase
node_comments -.->|"stores discussion"| node_supabase
node_community -.->|"loads community feed"| node_supabase
node_sharedlists -.->|"stores shared lists"| node_supabase
node_settings -.->|"imports libraries"| node_storage
node_franchises -.->|"loads collections"| node_tmdb
node_search -.->|"spins watchlist"| node_storage

click node_app "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/app.js"
click node_router "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/router.js"
click node_home "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/home.js"
click node_browse "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/browse.js"
click node_search "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/search.js"
click node_details "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/details.js"
click node_franchises "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/franchises.js"
click node_anime "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/anime.js"
click node_core "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/core.js"
click node_storage "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/storage.js"
click node_settings "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/settings.js"
click node_profiles "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/profiles.js"
click node_player "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/player.js"
click node_party "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/party.js"
click node_comments "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/comments.js"
click node_community "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/community.js"
click node_sharedlists "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/sharedlists.js"
click node_shareapi "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/share.js"
click node_auth "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/auth.js"
click node_views "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/views.js"
click node_proxy "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/proxy.js"
click node_rate "https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/_ratelimit.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_app,node_router,node_home,node_browse,node_search,node_details,node_franchises,node_anime,node_core,node_views,node_viewer toneBlue
class node_storage,node_settings,node_profiles,node_auth,node_supabase,node_browser toneAmber
class node_player,node_party toneMint
class node_comments,node_community,node_sharedlists,node_shareapi toneRose
class node_proxy,node_rate,node_tmdb,node_anilist,node_mirrors toneIndigo
```

## Components

### App Shell & Discovery

- [App Composition](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/app.js): `js/app.js`
- [Navigation](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/router.js): `js/router.js`
- [Home Discovery](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/home.js): `js/home.js`
- [Browse](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/browse.js): `js/browse.js`
- [Search & Roulette](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/search.js): `js/search.js`
- [Title Details](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/details.js): `js/details.js`
- [Franchise Archives](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/franchises.js): `js/franchises.js`
- [Anime Mapping](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/anime.js): `api/anime.js`
- [Shared Runtime](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/core.js): `js/core.js`
- [View Rendering](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/views.js): `js/views.js`

### Library & Profiles

- [Watch Diary](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/storage.js): `js/storage.js`
- [Import & Settings](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/settings.js): `js/settings.js`
- [Profiles & Stats](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/profiles.js): `js/profiles.js`
- [Account Access](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/auth.js): `js/auth.js`

### Playback & Parties

- [Media Player](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/player.js): `js/player.js`
- [Watch Parties](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/party.js): `js/party.js`

### Community & Sharing

- [Title Comments](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/comments.js): `js/comments.js`
- [Community Feed](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/community.js): `js/community.js`
- [Shared Lists](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/js/sharedlists.js): `js/sharedlists.js`
- [Share Cards](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/share.js): `api/share.js`

### API & Data Services

- [TMDB Proxy](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/proxy.js): `api/proxy.js`
- [Rate Limiter](https://github.com/troubledkiller69-lgtm/alexandria/blob/main/api/_ratelimit.js): `api/_ratelimit.js`

### Other components

- **Viewer**
- **TMDB**
- **AniList**
- **Supabase**
- **Browser Storage**
- **Streaming Mirrors**

## Connections

- Viewer → App Composition: uses (evidence: `README.md`)
- App Composition → Shared Runtime: composes (evidence: `js/app.js`)
- App Composition → Navigation: composes (evidence: `js/app.js`)
- App Composition → Home Discovery: composes (evidence: `js/app.js`)
- App Composition → Browse: composes (evidence: `js/app.js`)
- App Composition → Search & Roulette: composes (evidence: `js/app.js`)
- App Composition → Title Details: composes (evidence: `js/app.js`)
- App Composition → Franchise Archives: composes (evidence: `js/app.js`)
- App Composition → Anime Mapping: composes (evidence: `js/app.js`)
- App Composition → Watch Diary: composes (evidence: `js/app.js`)
- App Composition → Import & Settings: composes (evidence: `js/app.js`)
- App Composition → Profiles & Stats: composes (evidence: `js/app.js`)
- App Composition → Media Player: composes (evidence: `js/app.js`)
- App Composition → Watch Parties: composes (evidence: `js/app.js`)
- App Composition → Title Comments: composes (evidence: `js/app.js`)
- App Composition → Community Feed: composes (evidence: `js/app.js`)
- App Composition → Shared Lists: composes (evidence: `js/app.js`)
- App Composition → Account Access: composes (evidence: `js/app.js`)
- App Composition → View Rendering: composes (evidence: `js/app.js`)
- Shared Runtime → TMDB Proxy: fetches titles (evidence: `js/core.js`)
- TMDB Proxy → TMDB: requests metadata (evidence: `api/proxy.js`)
- TMDB Proxy → Rate Limiter: checks limits (evidence: `api/proxy.js`)
- Anime Mapping → AniList: searches titles (evidence: `api/anime.js`)
- Anime Mapping → Supabase: reads mappings (evidence: `api/anime.js`)
- Anime Mapping → Rate Limiter: checks limits (evidence: `api/anime.js`)
- Share Cards → TMDB: loads metadata (evidence: `api/share.js`)
- Share Cards → Supabase: loads share data (evidence: `api/share.js`)
- Share Cards → Rate Limiter: checks limits (evidence: `api/share.js`)
- Watch Diary → Browser Storage: stores diary (evidence: `js/storage.js`)
- Watch Diary → Supabase: syncs diary (evidence: `js/storage.js`)
- Profiles & Stats → Supabase: loads profile data (evidence: `js/profiles.js`)
- Navigation → Media Player: routes playback (evidence: `js/router.js`)
- Navigation → Title Details: routes details (evidence: `js/router.js`)
- Media Player → Streaming Mirrors: selects streams (evidence: `README.md`)
- Watch Parties → Media Player: syncs playback (evidence: `README.md`)
- Watch Parties → Supabase: coordinates rooms (evidence: `README.md`)
- Account Access → Supabase: authenticates accounts (evidence: `README.md`)
- Title Comments → Supabase: stores discussion (evidence: `README.md`)
- Community Feed → Supabase: loads community feed (evidence: `README.md`)
- Shared Lists → Supabase: stores shared lists (evidence: `README.md`)
- Import & Settings → Watch Diary: imports libraries (evidence: `README.md`)
- Franchise Archives → TMDB: loads collections (evidence: `README.md`)
- Search & Roulette → Watch Diary: spins watchlist (evidence: `README.md`)
