# khanhtran47/sora architecture

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

- Interactive diagram: https://gitdiagram.com/khanhtran47/sora
- Repository: https://github.com/khanhtran47/sora

## Overview

SORA is a Remix app for exploring and watching movies, TV shows, and anime. The main user journey is to discover or search for a title, inspect its details, then watch available episodes or films in a custom player; accounts and watch history support that experience. Its routes and service tree also show distinct metadata, streaming-provider, subtitle, and authentication subsystems. The README establishes the product capabilities, while sampled source confirms selected service relationships; many route-to-service connections are not shown, so those edges are omitted.

Main entry points: [`app/routes/movies+/$movieId_.watch.tsx`](https://github.com/khanhtran47/sora/blob/master/app/routes/movies%2B/%24movieId_.watch.tsx) (Watch routes), [`app/components/layouts/GlobalPlayer.tsx`](https://github.com/khanhtran47/sora/blob/master/app/components/layouts/GlobalPlayer.tsx) (Global player), [`app/services/supabase/auth.server.ts`](https://github.com/khanhtran47/sora/blob/master/app/services/supabase/auth.server.ts) (Authentication), [`app/components/media/MediaDetail.tsx`](https://github.com/khanhtran47/sora/blob/master/app/components/media/MediaDetail.tsx) (Media details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Browse catalog"]
  node_catalog_routes["Browse routes"]
  node_media_routes["Media routes"]
  node_search_routes["Search routes"]
  node_people_routes["People routes"]
  node_media_details["Media details<br/>[MediaDetail.tsx]"]
  node_media_lists["Media lists<br/>[MediaList.tsx]"]
end

subgraph group_watching["Watch media"]
  node_watch_routes["Watch routes"]
  node_player["Global player<br/>[GlobalPlayer.tsx]"]
  node_player_settings["Player settings<br/>[PlayerSettings.tsx]"]
  node_subtitle_ui["Subtitle dialogs"]
  node_provider_api["Provider API<br/>[provider.ts]"]
  node_subtitle_api["Subtitle API"]
end

subgraph group_accounts["Accounts and history"]
  node_auth_routes["Sign-in routes<br/>[sign-in.tsx]"]
  node_auth_service["Authentication<br/>[auth.server.ts]"]
  node_auth_cookie["Session cookies<br/>[cookie.server.ts]"]
  node_history_routes["Watch history<br/>[watch-history.tsx]"]
  node_history_api["History API<br/>[history.ts]"]
  node_history_store[("History records<br/>[table.server.ts]")]
end

subgraph group_services["Media services"]
  node_tmdb["TMDB metadata<br/>[tmdb.server.ts]"]
  node_stream_providers["Stream providers<br/>[provider.server.ts]"]
  node_supabase["Supabase client<br/>[client.server.ts]"]
end

subgraph group_experience["App experience"]
  node_layout["App layout<br/>[Layout.tsx]"]
  node_settings["User settings<br/>[useLocalStorage.ts]"]
  node_i18n["Translations<br/>[i18next.server.ts]"]
end

node_viewer(("Viewer"))

node_viewer -->|"browses"| node_catalog_routes
node_viewer -->|"searches"| node_search_routes
node_viewer -->|"watches"| node_watch_routes
node_media_details -.->|"presents details"| node_viewer
node_watch_routes -.->|"plays media"| node_player
node_player -.->|"uses settings"| node_player_settings
node_player -.->|"configures subtitles"| node_subtitle_ui
node_watch_routes -.->|"requests streams"| node_provider_api
node_subtitle_ui -.->|"searches subtitles"| node_subtitle_api
node_auth_routes -.->|"authenticates"| node_auth_service
node_auth_service -->|"calls auth"| node_supabase
node_auth_service -->|"reads session"| node_auth_cookie
node_history_routes -.->|"loads history"| node_history_api
node_history_api -.->|"reads and writes"| node_history_store
node_history_store -->|"queries"| node_supabase
node_media_details -.->|"loads metadata"| node_tmdb
node_media_lists -.->|"shows titles"| node_viewer
node_provider_api -.->|"resolves providers"| node_stream_providers

click node_catalog_routes "https://github.com/khanhtran47/sora/tree/master/app/routes/discover%2B"
click node_media_routes "https://github.com/khanhtran47/sora/tree/master/app/routes/anime%2B"
click node_search_routes "https://github.com/khanhtran47/sora/tree/master/app/routes/search%2B"
click node_people_routes "https://github.com/khanhtran47/sora/tree/master/app/routes/people%2B"
click node_media_details "https://github.com/khanhtran47/sora/blob/master/app/components/media/MediaDetail.tsx"
click node_media_lists "https://github.com/khanhtran47/sora/blob/master/app/components/media/MediaList.tsx"
click node_watch_routes "https://github.com/khanhtran47/sora/blob/master/app/routes/movies%2B/%24movieId_.watch.tsx"
click node_player "https://github.com/khanhtran47/sora/blob/master/app/components/layouts/GlobalPlayer.tsx"
click node_player_settings "https://github.com/khanhtran47/sora/blob/master/app/components/elements/player/PlayerSettings.tsx"
click node_subtitle_ui "https://github.com/khanhtran47/sora/blob/master/app/components/elements/dialog/SearchSubtitleDialog.tsx"
click node_provider_api "https://github.com/khanhtran47/sora/blob/master/app/routes/api%2B/provider.ts"
click node_subtitle_api "https://github.com/khanhtran47/sora/blob/master/app/routes/api%2B/subtitles.search.ts"
click node_auth_routes "https://github.com/khanhtran47/sora/blob/master/app/routes/_auth%2B/sign-in.tsx"
click node_auth_service "https://github.com/khanhtran47/sora/blob/master/app/services/supabase/auth.server.ts"
click node_auth_cookie "https://github.com/khanhtran47/sora/blob/master/app/services/supabase/cookie.server.ts"
click node_history_routes "https://github.com/khanhtran47/sora/blob/master/app/routes/watch-history.tsx"
click node_history_api "https://github.com/khanhtran47/sora/blob/master/app/routes/api%2B/history.ts"
click node_history_store "https://github.com/khanhtran47/sora/blob/master/app/services/supabase/table.server.ts"
click node_tmdb "https://github.com/khanhtran47/sora/blob/master/app/services/tmdb/tmdb.server.ts"
click node_stream_providers "https://github.com/khanhtran47/sora/blob/master/app/services/provider.server.ts"
click node_supabase "https://github.com/khanhtran47/sora/blob/master/app/services/supabase/client.server.ts"
click node_layout "https://github.com/khanhtran47/sora/blob/master/app/components/layouts/Layout.tsx"
click node_settings "https://github.com/khanhtran47/sora/blob/master/app/utils/react/hooks/useLocalStorage.ts"
click node_i18n "https://github.com/khanhtran47/sora/blob/master/app/services/i18n/i18next.server.ts"

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_routes,node_media_routes,node_search_routes,node_people_routes,node_media_details,node_media_lists,node_viewer toneBlue
class node_watch_routes,node_player,node_player_settings,node_subtitle_ui,node_provider_api,node_subtitle_api toneAmber
class node_auth_routes,node_auth_service,node_auth_cookie,node_history_routes,node_history_api,node_history_store toneMint
class node_tmdb,node_stream_providers,node_supabase toneRose
class node_layout,node_settings,node_i18n toneIndigo
```

## Components

### Browse catalog

- [Browse routes](https://github.com/khanhtran47/sora/tree/master/app/routes/discover%2B): `app/routes/discover+`
- [Media routes](https://github.com/khanhtran47/sora/tree/master/app/routes/anime%2B): `app/routes/anime+`
- [Search routes](https://github.com/khanhtran47/sora/tree/master/app/routes/search%2B): `app/routes/search+`
- [People routes](https://github.com/khanhtran47/sora/tree/master/app/routes/people%2B): `app/routes/people+`
- [Media details](https://github.com/khanhtran47/sora/blob/master/app/components/media/MediaDetail.tsx): `app/components/media/MediaDetail.tsx`
- [Media lists](https://github.com/khanhtran47/sora/blob/master/app/components/media/MediaList.tsx): `app/components/media/MediaList.tsx`

### Watch media

- [Watch routes](https://github.com/khanhtran47/sora/blob/master/app/routes/movies%2B/%24movieId_.watch.tsx): `app/routes/movies+/$movieId_.watch.tsx`
- [Global player](https://github.com/khanhtran47/sora/blob/master/app/components/layouts/GlobalPlayer.tsx): `app/components/layouts/GlobalPlayer.tsx`
- [Player settings](https://github.com/khanhtran47/sora/blob/master/app/components/elements/player/PlayerSettings.tsx): `app/components/elements/player/PlayerSettings.tsx`
- [Subtitle dialogs](https://github.com/khanhtran47/sora/blob/master/app/components/elements/dialog/SearchSubtitleDialog.tsx): `app/components/elements/dialog/SearchSubtitleDialog.tsx`
- [Provider API](https://github.com/khanhtran47/sora/blob/master/app/routes/api%2B/provider.ts): `app/routes/api+/provider.ts`
- [Subtitle API](https://github.com/khanhtran47/sora/blob/master/app/routes/api%2B/subtitles.search.ts): `app/routes/api+/subtitles.search.ts`

### Accounts and history

- [Sign-in routes](https://github.com/khanhtran47/sora/blob/master/app/routes/_auth%2B/sign-in.tsx): `app/routes/_auth+/sign-in.tsx`
- [Authentication](https://github.com/khanhtran47/sora/blob/master/app/services/supabase/auth.server.ts): `app/services/supabase/auth.server.ts`
- [Session cookies](https://github.com/khanhtran47/sora/blob/master/app/services/supabase/cookie.server.ts): `app/services/supabase/cookie.server.ts`
- [Watch history](https://github.com/khanhtran47/sora/blob/master/app/routes/watch-history.tsx): `app/routes/watch-history.tsx`
- [History API](https://github.com/khanhtran47/sora/blob/master/app/routes/api%2B/history.ts): `app/routes/api+/history.ts`
- [History records](https://github.com/khanhtran47/sora/blob/master/app/services/supabase/table.server.ts): `app/services/supabase/table.server.ts`

### Media services

- [TMDB metadata](https://github.com/khanhtran47/sora/blob/master/app/services/tmdb/tmdb.server.ts): `app/services/tmdb/tmdb.server.ts`
- [Stream providers](https://github.com/khanhtran47/sora/blob/master/app/services/provider.server.ts): `app/services/provider.server.ts`
- [Supabase client](https://github.com/khanhtran47/sora/blob/master/app/services/supabase/client.server.ts): `app/services/supabase/client.server.ts`

### App experience

- [App layout](https://github.com/khanhtran47/sora/blob/master/app/components/layouts/Layout.tsx): `app/components/layouts/Layout.tsx`
- [User settings](https://github.com/khanhtran47/sora/blob/master/app/utils/react/hooks/useLocalStorage.ts): `app/utils/react/hooks/useLocalStorage.ts`
- [Translations](https://github.com/khanhtran47/sora/blob/master/app/services/i18n/i18next.server.ts): `app/services/i18n/i18next.server.ts`

### Other components

- **Viewer**

## Connections

- Viewer → Browse routes: browses
- Viewer → Search routes: searches
- Viewer → Watch routes: watches
- Media details → Viewer: presents details
- Watch routes → Global player: plays media
- Global player → Player settings: uses settings
- Global player → Subtitle dialogs: configures subtitles
- Watch routes → Provider API: requests streams
- Subtitle dialogs → Subtitle API: searches subtitles
- Sign-in routes → Authentication: authenticates
- Authentication → Supabase client: calls auth (evidence: `app/services/supabase/auth.server.ts`)
- Authentication → Session cookies: reads session (evidence: `app/services/supabase/auth.server.ts`)
- Watch history → History API: loads history
- History API → History records: reads and writes
- History records → Supabase client: queries (evidence: `app/services/supabase/table.server.ts`)
- Media details → TMDB metadata: loads metadata
- Media lists → Viewer: shows titles
- Provider API → Stream providers: resolves providers
