# itscasaa/casaflix-public architecture

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

- Interactive diagram: https://gitdiagram.com/itscasaa/casaflix-public
- Repository: https://github.com/itscasaa/casaflix-public

## Overview

CasaFlix is a Netflix-styled movie, TV, anime, and live-streaming application. Its main user journey is discovering or searching for media, opening a detail page, and playing a stream with subtitles and playback controls; playback progress can feed history and watchlist experiences. Other major capabilities include account management, metadata fallback, and an ad-filtering HLS proxy. The README documents several integrations, but sampled source is limited, so links for unsampled subsystems are shown only where supported by the tree or documentation.

Main entry points: [`apps/web/app/(catalog)/page.tsx`](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/page.tsx) (Catalog pages), [`apps/web/components/media/media-client.tsx`](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/components/media/media-client.tsx) (Playback interface), [`apps/web/app/(catalog)/movies/[id]/page.tsx`](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/movies/%5Bid%5D/page.tsx) (Media details), [`apps/web/app/api/proxy/hls/route.ts`](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/proxy/hls/route.ts) (HLS proxy route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Discovery and catalog"]
  node_catalog["Catalog pages<br/>[page.tsx]"]
  node_search["Search page<br/>[page.tsx]"]
  node_search_logic["Search results"]
  node_media_detail["Media details<br/>[page.tsx]"]
  node_anime_catalog["Anime catalog<br/>[page.tsx]"]
end

subgraph group_accounts["Accounts and library"]
  node_account["Account flows<br/>[page.tsx]"]
  node_watchlist["Watchlist<br/>[page.tsx]"]
  node_history["Viewing history<br/>[page.tsx]"]
end

subgraph group_playback["Playback"]
  node_watch_entry["Watch route<br/>[page.tsx]"]
  node_media_player["Playback interface<br/>[media-client.tsx]"]
  node_hls_engine["HLS proxy engine<br/>[hls-engine.ts]"]
  node_progress_storage["Progress ledger"]
end

subgraph group_services["APIs and integrations"]
  node_search_api["Search API<br/>[route.ts]"]
  node_auth_api["Authentication API<br/>[route.ts]"]
  node_watchlist_api["Watchlist API<br/>[route.ts]"]
  node_hls_api["HLS proxy route<br/>[route.ts]"]
  node_segment_api["Segment proxy route<br/>[route.ts]"]
  node_subtitle_api["Subtitle API<br/>[route.ts]"]
  node_progress_api["Progress API<br/>[route.ts]"]
end

subgraph group_runtime["Shared application"]
  node_query_provider["Query provider<br/>[query-client.tsx]"]
end

node_viewer(("Viewer"))
node_tmdb["TMDb"]
node_watchmode["Watchmode"]
node_subtitle_service["OpenSubtitles"]
node_stream_origin["Stream provider"]

node_viewer -->|"browses"| node_catalog
node_viewer -->|"searches"| node_search
node_viewer -->|"signs in"| node_account
node_viewer -->|"watches"| node_watch_entry
node_catalog -->|"opens details"| node_media_detail
node_catalog -->|"browses anime"| node_anime_catalog
node_search -->|"queries"| node_search_logic
node_search_logic -->|"requests results"| node_search_api
node_account -->|"authenticates"| node_auth_api
node_viewer -->|"manages list"| node_watchlist
node_watchlist -->|"updates list"| node_watchlist_api
node_watch_entry -->|"starts playback"| node_media_player
node_media_player -->|"requests playlist"| node_hls_api
node_hls_api -->|"rewrites playlist"| node_hls_engine
node_hls_api -->|"fetches playlist"| node_stream_origin
node_segment_api -->|"fetches segments"| node_stream_origin
node_media_player -->|"requests subtitles"| node_subtitle_api
node_media_player -->|"saves progress"| node_progress_api
node_progress_api -->|"uses ledger"| node_progress_storage
node_progress_storage -->|"supplies progress"| node_history
node_media_detail -->|"loads metadata"| node_tmdb
node_media_detail -.->|"fallback metadata"| node_watchmode
node_subtitle_api -->|"gets subtitles"| node_subtitle_service
node_catalog -->|"uses queries"| node_query_provider

click node_catalog "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/page.tsx"
click node_search "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/search/page.tsx"
click node_search_logic "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/hooks/useSearchResults.ts"
click node_search_api "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/search/route.ts"
click node_media_detail "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/movies/%5Bid%5D/page.tsx"
click node_anime_catalog "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/anime/page.tsx"
click node_account "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(account)/login/page.tsx"
click node_auth_api "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/auth/%5B...nextauth%5D/route.ts"
click node_watchlist "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(library)/watchlist/page.tsx"
click node_watchlist_api "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/watchlist/route.ts"
click node_history "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(library)/history/page.tsx"
click node_watch_entry "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(compat)/watch/%5Bid%5D/page.tsx"
click node_media_player "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/components/media/media-client.tsx"
click node_hls_engine "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/lib/proxy/hls-engine.ts"
click node_hls_api "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/proxy/hls/route.ts"
click node_segment_api "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/proxy/segment/route.ts"
click node_subtitle_api "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/subtitles/%5BmediaType%5D/%5Bid%5D/route.ts"
click node_progress_api "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/playback/progress/route.ts"
click node_progress_storage "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/lib/playback/progress-storage.ts"
click node_query_provider "https://github.com/itscasaa/casaflix-public/blob/main/apps/web/lib/query-client.tsx"

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_catalog,node_search,node_search_logic,node_media_detail,node_anime_catalog,node_viewer toneBlue
class node_account,node_watchlist,node_history toneAmber
class node_watch_entry,node_media_player,node_hls_engine,node_progress_storage toneMint
class node_search_api,node_auth_api,node_watchlist_api,node_hls_api,node_segment_api,node_subtitle_api,node_progress_api toneRose
class node_query_provider,node_tmdb,node_watchmode,node_subtitle_service,node_stream_origin toneIndigo
```

## Components

### Discovery and catalog

- [Catalog pages](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/page.tsx): `apps/web/app/(catalog)/page.tsx`
- [Search page](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/search/page.tsx): `apps/web/app/(catalog)/search/page.tsx`
- [Search results](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/hooks/useSearchResults.ts): `apps/web/hooks/useSearchResults.ts`
- [Media details](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/movies/%5Bid%5D/page.tsx): `apps/web/app/(catalog)/movies/[id]/page.tsx`
- [Anime catalog](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(catalog)/anime/page.tsx): `apps/web/app/(catalog)/anime/page.tsx`

### Accounts and library

- [Account flows](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(account)/login/page.tsx): `apps/web/app/(account)/login/page.tsx`
- [Watchlist](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(library)/watchlist/page.tsx): `apps/web/app/(library)/watchlist/page.tsx`
- [Viewing history](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(library)/history/page.tsx): `apps/web/app/(library)/history/page.tsx`

### Playback

- [Watch route](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/(compat)/watch/%5Bid%5D/page.tsx): `apps/web/app/(compat)/watch/[id]/page.tsx`
- [Playback interface](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/components/media/media-client.tsx): `apps/web/components/media/media-client.tsx`
- [HLS proxy engine](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/lib/proxy/hls-engine.ts): `apps/web/lib/proxy/hls-engine.ts`
- [Progress ledger](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/lib/playback/progress-storage.ts): `apps/web/lib/playback/progress-storage.ts`

### APIs and integrations

- [Search API](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/search/route.ts): `apps/web/app/api/search/route.ts`
- [Authentication API](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/auth/%5B...nextauth%5D/route.ts): `apps/web/app/api/auth/[...nextauth]/route.ts`
- [Watchlist API](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/watchlist/route.ts): `apps/web/app/api/watchlist/route.ts`
- [HLS proxy route](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/proxy/hls/route.ts): `apps/web/app/api/proxy/hls/route.ts`
- [Segment proxy route](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/proxy/segment/route.ts): `apps/web/app/api/proxy/segment/route.ts`
- [Subtitle API](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/subtitles/%5BmediaType%5D/%5Bid%5D/route.ts): `apps/web/app/api/subtitles/[mediaType]/[id]/route.ts`
- [Progress API](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/app/api/playback/progress/route.ts): `apps/web/app/api/playback/progress/route.ts`

### Shared application

- [Query provider](https://github.com/itscasaa/casaflix-public/blob/main/apps/web/lib/query-client.tsx): `apps/web/lib/query-client.tsx`

### Other components

- **Viewer**
- **TMDb**
- **Watchmode**
- **OpenSubtitles**
- **Stream provider**

## Connections

- Viewer → Catalog pages: browses
- Viewer → Search page: searches
- Viewer → Account flows: signs in
- Viewer → Watch route: watches
- Catalog pages → Media details: opens details
- Catalog pages → Anime catalog: browses anime
- Search page → Search results: queries
- Search results → Search API: requests results
- Account flows → Authentication API: authenticates
- Viewer → Watchlist: manages list
- Watchlist → Watchlist API: updates list
- Watch route → Playback interface: starts playback
- Playback interface → HLS proxy route: requests playlist
- HLS proxy route → HLS proxy engine: rewrites playlist
- HLS proxy route → Stream provider: fetches playlist
- Segment proxy route → Stream provider: fetches segments
- Playback interface → Subtitle API: requests subtitles
- Playback interface → Progress API: saves progress
- Progress API → Progress ledger: uses ledger
- Progress ledger → Viewing history: supplies progress
- Media details → TMDb: loads metadata
- Media details → Watchmode: fallback metadata
- Subtitle API → OpenSubtitles: gets subtitles
- Catalog pages → Query provider: uses queries
