# penguin12463/watchlist architecture

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

- Interactive diagram: https://gitdiagram.com/penguin12463/watchlist
- Repository: https://github.com/penguin12463/watchlist

## Overview

Watchlyst is a watchlist app with a static JavaScript client and a Cloudflare Worker API; the tree also contains a separate ASP.NET/Blazor application. The principal static-client flow is user sign-in through Clerk, authenticated API requests for lists and movies, and rendering or editing watch progress. Collections, list sharing, settings, and TMDB lookup are represented as product capabilities in the client modules and API usage. The Worker implementation and several client modules were not excerpted, so their internal behavior and database wiring are not asserted.

Main entry points: [`static-client/js/api.js`](https://github.com/penguin12463/watchlist/blob/main/static-client/js/api.js) (API client), [`Program.cs`](https://github.com/penguin12463/watchlist/blob/main/Program.cs) (ASP.NET startup), [`static-client/js/app.js`](https://github.com/penguin12463/watchlist/blob/main/static-client/js/app.js) (Page entry), [`Data/ApplicationDbContext.cs`](https://github.com/penguin12463/watchlist/blob/main/Data/ApplicationDbContext.cs) (Entity context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Static client"]
  node_cliententry["Page entry<br/>[app.js]"]
  node_standalone["Standalone client<br/>[app.js]"]
  node_authclient["Client auth<br/>[clerk-init.js]"]
  node_apiclient["API client<br/>[api.js]"]
  node_movieui["Movie lists<br/>[movies.js]"]
  node_settings["List settings<br/>[settings.js]"]
  node_tmdbclient["TMDB lookup<br/>[tmdb.js]"]
  node_clientconfig["Client config<br/>[config.js]"]
end

subgraph group_api["Worker API"]
  node_worker["Watchlyst API<br/>[index.ts]"]
end

subgraph group_legacy["ASP.NET app"]
  node_serverentry["ASP.NET startup<br/>[Program.cs]"]
  node_serverauth["Server auth state"]
  node_userservice["User service<br/>[UserService.cs]"]
  node_usercontract["User contract<br/>[IUserService.cs]"]
  node_servermovies["TMDB service<br/>[TmdbService.cs]"]
end

subgraph group_legacydata["Legacy data"]
  node_dbcontext["Entity context"]
  node_entities["Watchlist entities<br/>[Entities.cs]"]
  node_sqlite[("SQLite database")]
end

node_viewer(("Watchlist user"))
node_clerk{{"Clerk auth"}}
node_tmdb{{"TMDB"}}
node_neondb[("Neon database")]

node_viewer -->|"uses"| node_cliententry
node_cliententry -->|"initializes"| node_authclient
node_cliententry -->|"requests"| node_apiclient
node_cliententry -->|"loads movies"| node_movieui
node_cliententry -->|"uses lookup"| node_tmdbclient
node_authclient -->|"loads SDK"| node_clerk
node_apiclient -->|"gets token"| node_authclient
node_apiclient -->|"sends requests"| node_worker
node_movieui -->|"fetches and edits"| node_apiclient
node_settings -.->|"manages lists"| node_apiclient
node_tmdbclient -.->|"uses API"| node_apiclient
node_standalone -->|"sends requests"| node_worker
node_standalone -->|"initializes"| node_clerk
node_worker -.->|"reads and writes"| node_neondb
node_viewer -->|"uses"| node_standalone
node_serverentry -->|"registers"| node_serverauth
node_serverentry -->|"configures"| node_dbcontext
node_serverentry -->|"registers service"| node_usercontract
node_serverentry -->|"registers service"| node_userservice
node_serverentry -->|"registers service"| node_servermovies
node_userservice -->|"implements"| node_usercontract
node_userservice -->|"queries users"| node_dbcontext
node_dbcontext -->|"uses provider"| node_sqlite
node_dbcontext -.->|"maps entities"| node_entities
node_servermovies -->|"queries"| node_tmdb

click node_cliententry "https://github.com/penguin12463/watchlist/blob/main/static-client/js/app.js"
click node_standalone "https://github.com/penguin12463/watchlist/blob/main/static-client/app.js"
click node_authclient "https://github.com/penguin12463/watchlist/blob/main/static-client/js/clerk-init.js"
click node_apiclient "https://github.com/penguin12463/watchlist/blob/main/static-client/js/api.js"
click node_movieui "https://github.com/penguin12463/watchlist/blob/main/static-client/js/movies.js"
click node_settings "https://github.com/penguin12463/watchlist/blob/main/static-client/js/settings.js"
click node_tmdbclient "https://github.com/penguin12463/watchlist/blob/main/static-client/js/tmdb.js"
click node_clientconfig "https://github.com/penguin12463/watchlist/blob/main/static-client/config.js"
click node_worker "https://github.com/penguin12463/watchlist/blob/main/neon-worker/src/index.ts"
click node_serverentry "https://github.com/penguin12463/watchlist/blob/main/Program.cs"
click node_serverauth "https://github.com/penguin12463/watchlist/blob/main/Components/Auth/ServerAuthenticationStateProvider.cs"
click node_userservice "https://github.com/penguin12463/watchlist/blob/main/Services/UserService.cs"
click node_usercontract "https://github.com/penguin12463/watchlist/blob/main/Services/IUserService.cs"
click node_servermovies "https://github.com/penguin12463/watchlist/blob/main/Services/TmdbService.cs"
click node_dbcontext "https://github.com/penguin12463/watchlist/blob/main/Data/ApplicationDbContext.cs"
click node_entities "https://github.com/penguin12463/watchlist/blob/main/Data/Entities.cs"

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_cliententry,node_standalone,node_authclient,node_apiclient,node_movieui,node_settings,node_tmdbclient,node_clientconfig,node_viewer toneBlue
class node_worker,node_neondb toneAmber
class node_serverentry,node_serverauth,node_userservice,node_usercontract,node_servermovies toneMint
class node_dbcontext,node_entities,node_sqlite toneRose
class node_clerk,node_tmdb toneIndigo
```

## Components

### Static client

- [Page entry](https://github.com/penguin12463/watchlist/blob/main/static-client/js/app.js): `static-client/js/app.js`
- [Standalone client](https://github.com/penguin12463/watchlist/blob/main/static-client/app.js): `static-client/app.js`
- [Client auth](https://github.com/penguin12463/watchlist/blob/main/static-client/js/clerk-init.js): `static-client/js/clerk-init.js`
- [API client](https://github.com/penguin12463/watchlist/blob/main/static-client/js/api.js): `static-client/js/api.js`
- [Movie lists](https://github.com/penguin12463/watchlist/blob/main/static-client/js/movies.js): `static-client/js/movies.js`
- [List settings](https://github.com/penguin12463/watchlist/blob/main/static-client/js/settings.js): `static-client/js/settings.js`
- [TMDB lookup](https://github.com/penguin12463/watchlist/blob/main/static-client/js/tmdb.js): `static-client/js/tmdb.js`
- [Client config](https://github.com/penguin12463/watchlist/blob/main/static-client/config.js): `static-client/config.js`

### Worker API

- [Watchlyst API](https://github.com/penguin12463/watchlist/blob/main/neon-worker/src/index.ts): `neon-worker/src/index.ts`

### ASP.NET app

- [ASP.NET startup](https://github.com/penguin12463/watchlist/blob/main/Program.cs): `Program.cs`
- [Server auth state](https://github.com/penguin12463/watchlist/blob/main/Components/Auth/ServerAuthenticationStateProvider.cs): `Components/Auth/ServerAuthenticationStateProvider.cs`
- [User service](https://github.com/penguin12463/watchlist/blob/main/Services/UserService.cs): `Services/UserService.cs`
- [User contract](https://github.com/penguin12463/watchlist/blob/main/Services/IUserService.cs): `Services/IUserService.cs`
- [TMDB service](https://github.com/penguin12463/watchlist/blob/main/Services/TmdbService.cs): `Services/TmdbService.cs`

### Legacy data

- [Entity context](https://github.com/penguin12463/watchlist/blob/main/Data/ApplicationDbContext.cs): `Data/ApplicationDbContext.cs`
- [Watchlist entities](https://github.com/penguin12463/watchlist/blob/main/Data/Entities.cs): `Data/Entities.cs`
- **SQLite database**

### Other components

- **Watchlist user**
- **Clerk auth**
- **TMDB**
- **Neon database**

## Connections

- Watchlist user → Page entry: uses (evidence: `static-client/js/app.js`)
- Page entry → Client auth: initializes (evidence: `static-client/js/app.js`)
- Page entry → API client: requests (evidence: `static-client/js/app.js`)
- Page entry → Movie lists: loads movies (evidence: `static-client/js/app.js`)
- Page entry → TMDB lookup: uses lookup (evidence: `static-client/js/app.js`)
- Client auth → Clerk auth: loads SDK (evidence: `static-client/js/clerk-init.js`)
- API client → Client auth: gets token (evidence: `static-client/js/api.js`)
- API client → Watchlyst API: sends requests (evidence: `static-client/js/api.js`)
- Movie lists → API client: fetches and edits (evidence: `static-client/js/movies.js`)
- List settings → API client: manages lists (evidence: `static-client/js/settings.js`)
- TMDB lookup → API client: uses API (evidence: `static-client/js/tmdb.js`)
- Standalone client → Watchlyst API: sends requests (evidence: `static-client/app.js`)
- Standalone client → Clerk auth: initializes (evidence: `static-client/app.js`)
- Watchlyst API → Neon database: reads and writes
- Watchlist user → Standalone client: uses (evidence: `static-client/app.js`)
- ASP.NET startup → Server auth state: registers (evidence: `Program.cs`)
- ASP.NET startup → Entity context: configures (evidence: `Program.cs`)
- ASP.NET startup → User contract: registers service (evidence: `Program.cs`)
- ASP.NET startup → User service: registers service (evidence: `Program.cs`)
- ASP.NET startup → TMDB service: registers service (evidence: `Program.cs`)
- User service → User contract: implements (evidence: `Services/UserService.cs`)
- User service → Entity context: queries users (evidence: `Services/UserService.cs`)
- Entity context → SQLite database: uses provider
- Entity context → Watchlist entities: maps entities
- TMDB service → TMDB: queries (evidence: `Services/TmdbService.cs`)
