How librespark/libretv works
LibreTV is a Next.js video aggregation and playback platform. Users configure on-demand and live sources, search across selected providers, inspect and compare results, then watch or download episodes; separate workflows cover IPTV, recommendations, source subscriptions, and playback history. The graph follows documented features and relationships visible in the README or supplied source excerpts/index. Several route and UI implementations were not sampled, so some documented subsystem links are shown as unverified dashed edges.
Main entry points: client-api.ts Client API · watch/page.tsx Watch Page · route.ts Aggregated Search · live/page.tsx Live Browser
Components 32
Discovery
- Home & Search
src/app/page.tsx - Aggregated Search
src/app/api/search/route.ts - CMS Parsing
src/lib/cms-parser.ts - Video Details
src/app/api/detail/route.ts - Recommendations
src/components/douban-section.tsx - Recommendation APIs
src/app/api/douban/route.ts
Playback
- Watch Page
src/app/watch/page.tsx - Video Player
src/components/player-shell.tsx - Source Switching
src/components/switch-source.tsx - Episode Downloads
src/components/download-manager.tsx - Playback History
src/lib/db.ts
Live TV
- Live Browser
src/app/live/page.tsx - Channel List
src/components/live-channel-list.tsx - Live Player
src/components/live-player.tsx - Playlist API
src/app/api/live/playlist/route.ts - EPG API
src/app/api/live/epg/route.ts - Live Stream Proxy
src/app/api/live/stream/route.ts
Sources & Settings
- Source Management
src/components/source-manager.tsx - Live Sources
src/components/live-source-manager.tsx - Subscription Sync
src/lib/subscription-sync.ts - Source List Parsing
src/lib/source-list.ts - TVBOX Import
src/lib/tvbox-parser.ts - App State
src/lib/store.ts - Settings Storage
src/lib/persist-storage.ts
Platform Services
- Client API
src/lib/client-api.ts - Authentication
src/lib/auth.ts - API Guard
src/lib/api-guard.ts - Media Proxy
src/lib/proxy-handlers.ts
Other components
- Viewer
- Third-Party Sources
- Recommendation Services
- Browser Storage
Connections 37
- Viewer → Home & Search: searches
README.md - Home & Search → Client API: requests
src/app/page.tsx - Client API → Aggregated Search: posts search
src/lib/client-api.ts - Aggregated Search → CMS Parsing: parses results
src/app/api/search/route.ts - Aggregated Search → Third-Party Sources: queries sources
README.md - Home & Search → Video Details: loads details
- Client API → Video Details: requests detail
src/lib/client-api.ts - Viewer → Recommendations: browses picks
README.md - Recommendations → Client API: requests picks
- Client API → Recommendation APIs: requests recommendations
src/lib/client-api.ts - Recommendation APIs → Recommendation Services: fetches data
README.md - Viewer → Watch Page: watches episodes
README.md - Watch Page → Video Player: renders player
src/app/watch/page.tsx - Watch Page → Source Switching: offers switching
src/app/watch/page.tsx - Watch Page → Episode Downloads: offers downloads
src/app/watch/page.tsx - Watch Page → Playback History: saves progress
README.md - Playback History → Browser Storage: persists locally
README.md - Viewer → Live Browser: opens live TV
README.md - Live Browser → Channel List: shows channels
- Channel List → Client API: loads playlists
- Client API → Playlist API: requests playlist
src/lib/client-api.ts - Playlist API → Third-Party Sources: fetches playlist
- Live Browser → Live Player: plays channel
- Live Player → Live Stream Proxy: retries via proxy
README.md - Live Browser → EPG API: loads schedules
- Viewer → Source Management: manages sources
README.md - Source Management → Live Sources: renders live settings
src/components/source-manager.tsx - Source Management → App State: updates settings
src/components/source-manager.tsx - Source Management → Subscription Sync: syncs subscriptions
src/components/source-manager.tsx - Subscription Sync → Client API: fetches lists
src/lib/subscription-sync.ts - Subscription Sync → Source List Parsing: parses lists
src/lib/subscription-sync.ts - TVBOX Import → Source List Parsing: normalizes imports
src/lib/tvbox-parser.ts - App State → Settings Storage: persists preferences
src/lib/store.ts - Client API → API Guard: calls protected APIs
- API Guard → Authentication: checks session
src/lib/api-guard.ts - Aggregated Search → API Guard: guards requests
src/app/api/search/route.ts - Media Proxy → Third-Party Sources: proxies media