# trakt/trakt-time architecture

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

- Interactive diagram: https://gitdiagram.com/trakt/trakt-time
- Repository: https://github.com/trakt/trakt-time

## Overview

trakt-time is a mobile-first SvelteKit Trakt client. Its main user journey is to authenticate, browse or search media, then track and discuss what they watch. The graph includes the query layer that mediates server data and several documented-by-tree product branches. The README identifies the Trakt API and Typesense, but sampled source does not establish all integration wiring; uncertain links are omitted.

Main entry points: [`projects/client/src`](https://github.com/trakt/trakt-time/tree/main/projects/client/src) (SvelteKit client), [`projects/client/src/lib/features/search/useSearch.ts`](https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/search/useSearch.ts) (Search), [`projects/client/src/lib/features/auth/stores/initializeUserManager.ts`](https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/auth/stores/initializeUserManager.ts) (Auth session), [`projects/client/src/lib/features/query/useQuery.ts`](https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/query/useQuery.ts) (Query client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Client experience"]
  node_client["SvelteKit client"]
  node_navigation["Navigation"]
  node_analytics["Analytics"]
  node_delight["Viewing celebrations"]
end

subgraph group_identity["Identity and session"]
  node_auth["Auth session"]
  node_token_route["Token endpoint<br/>[+server.ts]"]
end

subgraph group_data["Data access"]
  node_query["Query client<br/>[useQuery.ts]"]
  node_query_provider["Query provider"]
  node_search_queries["Search queries"]
end

subgraph group_media["Media features"]
  node_discover["Discover and filters"]
  node_search["Search<br/>[useSearch.ts]"]
  node_calendar["Calendar"]
  node_lists["Lists"]
  node_tracking["Watch tracking"]
  node_compare["Compare"]
  node_profile["Leaderboard and profile"]
end

subgraph group_community["Social features"]
  node_comments["Comments and GIFs"]
  node_reactions["Reactions"]
end

node_viewer(("Viewer"))
node_oidc["OIDC authority"]
node_trakt["Trakt API"]
node_typesense["Typesense"]

node_viewer -->|"uses"| node_client
node_client -->|"renders"| node_navigation
node_client -->|"initializes"| node_auth
node_auth -->|"authenticates"| node_oidc
node_auth -->|"posts token"| node_token_route
node_client -->|"provides client"| node_query_provider
node_search -->|"fetches queries"| node_query
node_query_provider -->|"supplies client"| node_query
node_search -->|"selects queries"| node_search_queries
node_query -->|"requests data"| node_trakt
node_search_queries -.->|"search integration"| node_typesense
node_viewer -->|"searches"| node_search
node_viewer -->|"browses"| node_discover
node_viewer -->|"checks schedule"| node_calendar
node_viewer -->|"manages lists"| node_lists
node_viewer -->|"tracks viewing"| node_tracking
node_viewer -->|"compares profiles"| node_compare
node_viewer -->|"views rankings"| node_profile
node_viewer -->|"comments"| node_comments
node_comments -->|"supports reactions"| node_reactions
node_search -->|"tracks searches"| node_analytics
node_tracking -->|"celebrates milestones"| node_delight

click node_client "https://github.com/trakt/trakt-time/tree/main/projects/client/src"
click node_navigation "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/navigation"
click node_discover "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/discover"
click node_search "https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/search/useSearch.ts"
click node_calendar "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/calendar"
click node_lists "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/sections/lists"
click node_tracking "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/components/buttons/check-in"
click node_auth "https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/auth/stores/initializeUserManager.ts"
click node_token_route "https://github.com/trakt/trakt-time/blob/main/projects/client/src/routes/api/store-token/%2Bserver.ts"
click node_query "https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/query/useQuery.ts"
click node_query_provider "https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/query/QueryClientProvider.svelte"
click node_search_queries "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/requests/queries/search"
click node_compare "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/compare"
click node_profile "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/leaderboard"
click node_comments "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/components/comment-drawer"
click node_reactions "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/reactions"
click node_analytics "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/analytics"
click node_delight "https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/delight"

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_client,node_navigation,node_analytics,node_delight,node_viewer toneBlue
class node_auth,node_token_route toneAmber
class node_query,node_query_provider,node_search_queries,node_trakt toneMint
class node_discover,node_search,node_calendar,node_lists,node_tracking,node_compare,node_profile toneRose
class node_comments,node_reactions,node_oidc,node_typesense toneIndigo
```

## Components

### Client experience

- [SvelteKit client](https://github.com/trakt/trakt-time/tree/main/projects/client/src): `projects/client/src`
- [Navigation](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/navigation): `projects/client/src/lib/features/navigation`
- [Analytics](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/analytics): `projects/client/src/lib/features/analytics`
- [Viewing celebrations](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/delight): `projects/client/src/lib/features/delight`

### Identity and session

- [Auth session](https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/auth/stores/initializeUserManager.ts): `projects/client/src/lib/features/auth/stores/initializeUserManager.ts`
- [Token endpoint](https://github.com/trakt/trakt-time/blob/main/projects/client/src/routes/api/store-token/%2Bserver.ts): `projects/client/src/routes/api/store-token/+server.ts`

### Data access

- [Query client](https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/query/useQuery.ts): `projects/client/src/lib/features/query/useQuery.ts`
- [Query provider](https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/query/QueryClientProvider.svelte): `projects/client/src/lib/features/query/QueryClientProvider.svelte`
- [Search queries](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/requests/queries/search): `projects/client/src/lib/requests/queries/search`

### Media features

- [Discover and filters](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/discover): `projects/client/src/lib/features/discover`
- [Search](https://github.com/trakt/trakt-time/blob/main/projects/client/src/lib/features/search/useSearch.ts): `projects/client/src/lib/features/search/useSearch.ts`
- [Calendar](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/calendar): `projects/client/src/lib/features/calendar`
- [Lists](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/sections/lists): `projects/client/src/lib/sections/lists`
- [Watch tracking](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/components/buttons/check-in): `projects/client/src/lib/components/buttons/check-in`
- [Compare](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/compare): `projects/client/src/lib/features/compare`
- [Leaderboard and profile](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/leaderboard): `projects/client/src/lib/features/leaderboard`

### Social features

- [Comments and GIFs](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/components/comment-drawer): `projects/client/src/lib/components/comment-drawer`
- [Reactions](https://github.com/trakt/trakt-time/tree/main/projects/client/src/lib/features/reactions): `projects/client/src/lib/features/reactions`

### Other components

- **Viewer**
- **OIDC authority**
- **Trakt API**
- **Typesense**

## Connections

- Viewer → SvelteKit client: uses
- SvelteKit client → Navigation: renders
- SvelteKit client → Auth session: initializes
- Auth session → OIDC authority: authenticates
- Auth session → Token endpoint: posts token
- SvelteKit client → Query provider: provides client
- Search → Query client: fetches queries
- Query provider → Query client: supplies client
- Search → Search queries: selects queries
- Query client → Trakt API: requests data
- Search queries → Typesense: search integration
- Viewer → Search: searches
- Viewer → Discover and filters: browses
- Viewer → Calendar: checks schedule
- Viewer → Lists: manages lists
- Viewer → Watch tracking: tracks viewing
- Viewer → Compare: compares profiles
- Viewer → Leaderboard and profile: views rankings
- Viewer → Comments and GIFs: comments
- Comments and GIFs → Reactions: supports reactions
- Search → Analytics: tracks searches
- Watch tracking → Viewing celebrations: celebrates milestones
