# esheliko/typecast architecture

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

- Interactive diagram: https://gitdiagram.com/esheliko/typecast
- Repository: https://github.com/esheliko/typecast

## Overview

Typecast is a private, installable watch-tracking app: users search films and series, inspect details and streaming availability, then mark titles and track progress in a personal library. That library also powers actor/title connections, spoiler-aware viewing, and “where do I know them from?” lookups. The graph preserves documented capabilities including Letterboxd import, calendar feeds, and in-watch answers. Several subsystems are represented by their exact source directories because their implementation was not sampled; those links are documented or omitted rather than inferred.

Main entry points: [`src/lib/library.ts`](https://github.com/esheliko/typecast/blob/main/src/lib/library.ts) (Library reads and sync), [`src/lib/tmdb.ts`](https://github.com/esheliko/typecast/blob/main/src/lib/tmdb.ts) (Film and TV metadata), [`src/components/TitleView.tsx`](https://github.com/esheliko/typecast/blob/main/src/components/TitleView.tsx) (Title details), [`src/lib/answer.ts`](https://github.com/esheliko/typecast/blob/main/src/lib/answer.ts) (Answer assembly)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_search["Search and browse<br/>[Search.tsx]"]
  node_title["Title details<br/>[TitleView.tsx]"]
  node_person["Person details<br/>[PersonView.tsx]"]
  node_watching["Watching answers<br/>[Watching.tsx]"]
end

subgraph group_discovery["Discovery and people"]
  node_who["Cast connections"]
  node_who_search["Actor finder"]
  node_connect["Shared cast<br/>[connect.ts]"]
  node_who_data["Cast and credit data<br/>[who-data.ts]"]
end

subgraph group_library["Personal library"]
  node_library_view["Library and stats<br/>[LibraryView.tsx]"]
  node_marks["Watch status and progress<br/>[actions.ts]"]
  node_library_data["Library reads and sync<br/>[library.ts]"]
  node_letterboxd["Letterboxd import<br/>[letterboxd.ts]"]
  node_calendar["Calendar feed<br/>[ical.ts]"]
end

subgraph group_services["Data services"]
  node_tmdb["Film and TV metadata<br/>[tmdb.ts]"]
  node_answer["Answer assembly<br/>[answer.ts]"]
end

subgraph group_platform["Account and platform"]
  node_supabase[("Supabase database and auth<br/>[server.ts]")]
  node_pwa["Installable app<br/>[sw.js]"]
end

node_viewer(("Viewer"))
node_external_data{{"TMDB service"}}
node_account(("Signed-in account"))

node_viewer -->|"searches titles"| node_search
node_search -->|"finds titles"| node_tmdb
node_tmdb -->|"fetches metadata"| node_external_data
node_viewer -->|"opens details"| node_title
node_title -->|"shows details"| node_tmdb
node_title -->|"updates watch status"| node_marks
node_account -->|"marks titles"| node_marks
node_marks -->|"writes library rows"| node_supabase
node_library_view -->|"reads library"| node_library_data
node_library_data -->|"reads saved titles"| node_supabase
node_library_data -->|"checks new episodes"| node_tmdb
node_viewer -->|"browses cast"| node_who
node_who -->|"finds shared titles"| node_connect
node_viewer -->|"asks where known"| node_who_search
node_who_search -->|"loads cast data"| node_who_data
node_who_data -->|"loads credits"| node_tmdb
node_viewer -->|"asks mid-watch"| node_watching
node_watching -->|"requests answers"| node_answer
node_answer -->|"uses library"| node_library_data
node_answer -->|"uses TMDB"| node_tmdb
node_viewer -->|"imports watch list"| node_letterboxd
node_letterboxd -->|"syncs titles"| node_library_data
node_viewer -->|"subscribes to feed"| node_calendar
node_calendar -->|"uses library"| node_library_data
node_viewer -->|"installs app"| node_pwa

click node_search "https://github.com/esheliko/typecast/blob/main/src/components/Search.tsx"
click node_title "https://github.com/esheliko/typecast/blob/main/src/components/TitleView.tsx"
click node_person "https://github.com/esheliko/typecast/blob/main/src/components/PersonView.tsx"
click node_watching "https://github.com/esheliko/typecast/blob/main/src/components/Watching.tsx"
click node_who "https://github.com/esheliko/typecast/tree/main/src/components/cast"
click node_who_search "https://github.com/esheliko/typecast/tree/main/src/components/who"
click node_connect "https://github.com/esheliko/typecast/blob/main/src/lib/connect.ts"
click node_who_data "https://github.com/esheliko/typecast/blob/main/src/lib/who-data.ts"
click node_library_view "https://github.com/esheliko/typecast/blob/main/src/components/LibraryView.tsx"
click node_marks "https://github.com/esheliko/typecast/blob/main/src/app/actions.ts"
click node_library_data "https://github.com/esheliko/typecast/blob/main/src/lib/library.ts"
click node_letterboxd "https://github.com/esheliko/typecast/blob/main/src/lib/letterboxd.ts"
click node_calendar "https://github.com/esheliko/typecast/blob/main/src/lib/ical.ts"
click node_tmdb "https://github.com/esheliko/typecast/blob/main/src/lib/tmdb.ts"
click node_answer "https://github.com/esheliko/typecast/blob/main/src/lib/answer.ts"
click node_supabase "https://github.com/esheliko/typecast/blob/main/src/lib/supabase/server.ts"
click node_pwa "https://github.com/esheliko/typecast/blob/main/public/sw.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_search,node_title,node_person,node_watching,node_viewer toneBlue
class node_who,node_who_search,node_connect,node_who_data toneAmber
class node_library_view,node_marks,node_library_data,node_letterboxd,node_calendar toneMint
class node_tmdb,node_answer toneRose
class node_supabase,node_pwa,node_external_data,node_account toneIndigo
```

## Components

### App experience

- [Search and browse](https://github.com/esheliko/typecast/blob/main/src/components/Search.tsx): `src/components/Search.tsx`
- [Title details](https://github.com/esheliko/typecast/blob/main/src/components/TitleView.tsx): `src/components/TitleView.tsx`
- [Person details](https://github.com/esheliko/typecast/blob/main/src/components/PersonView.tsx): `src/components/PersonView.tsx`
- [Watching answers](https://github.com/esheliko/typecast/blob/main/src/components/Watching.tsx): `src/components/Watching.tsx`

### Discovery and people

- [Cast connections](https://github.com/esheliko/typecast/tree/main/src/components/cast): `src/components/cast`
- [Actor finder](https://github.com/esheliko/typecast/tree/main/src/components/who): `src/components/who`
- [Shared cast](https://github.com/esheliko/typecast/blob/main/src/lib/connect.ts): `src/lib/connect.ts`
- [Cast and credit data](https://github.com/esheliko/typecast/blob/main/src/lib/who-data.ts): `src/lib/who-data.ts`

### Personal library

- [Library and stats](https://github.com/esheliko/typecast/blob/main/src/components/LibraryView.tsx): `src/components/LibraryView.tsx`
- [Watch status and progress](https://github.com/esheliko/typecast/blob/main/src/app/actions.ts): `src/app/actions.ts`
- [Library reads and sync](https://github.com/esheliko/typecast/blob/main/src/lib/library.ts): `src/lib/library.ts`
- [Letterboxd import](https://github.com/esheliko/typecast/blob/main/src/lib/letterboxd.ts): `src/lib/letterboxd.ts`
- [Calendar feed](https://github.com/esheliko/typecast/blob/main/src/lib/ical.ts): `src/lib/ical.ts`

### Data services

- [Film and TV metadata](https://github.com/esheliko/typecast/blob/main/src/lib/tmdb.ts): `src/lib/tmdb.ts`
- [Answer assembly](https://github.com/esheliko/typecast/blob/main/src/lib/answer.ts): `src/lib/answer.ts`

### Account and platform

- [Supabase database and auth](https://github.com/esheliko/typecast/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- [Installable app](https://github.com/esheliko/typecast/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Viewer**
- **TMDB service**
- **Signed-in account**

## Connections

- Viewer → Search and browse: searches titles (evidence: `README.md`)
- Search and browse → Film and TV metadata: finds titles
- Film and TV metadata → TMDB service: fetches metadata (evidence: `README.md`)
- Viewer → Title details: opens details (evidence: `README.md`)
- Title details → Film and TV metadata: shows details (evidence: `README.md`)
- Title details → Watch status and progress: updates watch status
- Signed-in account → Watch status and progress: marks titles (evidence: `src/app/actions.ts`)
- Watch status and progress → Supabase database and auth: writes library rows (evidence: `src/app/actions.ts`)
- Library and stats → Library reads and sync: reads library (evidence: `src/lib/library.ts`)
- Library reads and sync → Supabase database and auth: reads saved titles (evidence: `src/lib/library.ts`)
- Library reads and sync → Film and TV metadata: checks new episodes (evidence: `src/lib/library.ts`)
- Viewer → Cast connections: browses cast (evidence: `README.md`)
- Cast connections → Shared cast: finds shared titles (evidence: `README.md`)
- Viewer → Actor finder: asks where known (evidence: `README.md`)
- Actor finder → Cast and credit data: loads cast data
- Cast and credit data → Film and TV metadata: loads credits (evidence: `src/lib/who-data.ts`)
- Viewer → Watching answers: asks mid-watch (evidence: `README.md`)
- Watching answers → Answer assembly: requests answers (evidence: `README.md`)
- Answer assembly → Library reads and sync: uses library (evidence: `src/app/api/ask/route.ts`)
- Answer assembly → Film and TV metadata: uses TMDB (evidence: `README.md`)
- Viewer → Letterboxd import: imports watch list (evidence: `README.md`)
- Letterboxd import → Library reads and sync: syncs titles (evidence: `src/lib/library.ts`)
- Viewer → Calendar feed: subscribes to feed (evidence: `README.md`)
- Calendar feed → Library reads and sync: uses library (evidence: `src/app/api/event/route.ts`)
- Viewer → Installable app: installs app (evidence: `README.md`)
