How bariskisir/magnetplayer works
Magnet Player is a browser torrent-media player backed by a local Node helper. The main flow is: add or search for a magnet, open a torrent through the helper, select a media file, and play it while pieces download. The browser also keeps library, progress, preferences, and subtitle state. The helper exposes torrent, media, and search functionality, with torrent storage and optional transcoding beneath its HTTP routes. The graph follows the supplied tree and sampled source; links for unsampled route and subtitle internals are omitted where their wiring is unclear.
Main entry points: App.tsx App shell · useLibrary.ts Library workflow · engine.ts Torrent engine · server.ts HTTP server
Components 29
Browser app
- App shell
apps/web/src/app/App.tsx - Library workflow
apps/web/src/features/library/useLibrary.ts - Library controls
apps/web/src/features/library/Sidebar.tsx - Magnet entry
apps/web/src/features/library/MagnetForm.tsx - Session client
apps/web/src/features/helper/useTorrentSession.ts - Helper transport
apps/web/src/features/helper/transport.ts - Browser database
apps/web/src/shared/storage/database.ts - Library storage
apps/web/src/features/library/storage.ts
Helper HTTP
- Helper startup
packages/helper/src/cli/run.ts - HTTP server
packages/helper/src/http/server.ts - API routes
packages/helper/src/http/api.ts - Media routes
packages/helper/src/http/media.ts
Torrent runtime
- Torrent engine
packages/helper/src/torrent/engine.ts - Piece store
packages/helper/src/storage/piece-store.ts - Torrent files
packages/helper/src/storage/files.ts
Media features
- Player panel
apps/web/src/features/player/PlayerPanel.tsx - Playback control
apps/web/src/features/player/usePlayback.ts - Subtitle lookup
apps/web/src/features/subtitles/lookup.ts - Subtitle overlay
apps/web/src/features/subtitles/useSubtitleOverlay.ts - Subtitle cache
apps/web/src/features/subtitles/storage.ts - Transcoder
packages/helper/src/media/transcoder.ts - HLS support
packages/helper/src/media/hls.ts
Search
- Online search UI
apps/web/src/features/library/OnlineSearchDialog.tsx - Search providers
apps/web/src/shared/search-providers.ts - Search API
packages/helper/src/http/search/index.ts - Torrent providers
packages/helper/src/http/search/providers/knaben.ts
Other components
- Viewer
- Torrent peers
- Search services
Connections 32
- Viewer → App shell: uses
- App shell → Library workflow: manages
- App shell → Magnet entry: renders
- App shell → Library controls: renders
- App shell → Online search UI: renders
- App shell → Player panel: renders
- Magnet entry → Library workflow: submits magnet
- Library controls → Library workflow: selects titles
- Online search UI → Search providers: searches
- Online search UI → Library workflow: adds results
- Library workflow → Session client: opens session
- Library workflow → Library storage: persists entries
- Library storage → Browser database: reads and writes
- Session client → Helper transport: sends requests
- Player panel → Playback control: controls playback
- Playback control → Session client: selects and seeks
- Subtitle lookup → Subtitle cache: uses cache
- Subtitle cache → Browser database: reads and writes
- Helper startup → HTTP server: starts
- Helper transport → HTTP server: calls API
- HTTP server → API routes: dispatches API
- HTTP server → Media routes: dispatches media
- API routes → Torrent engine: controls torrents
- Media routes → Torrent engine: reads media
- Media routes → Transcoder: requests conversion
- Transcoder → HLS support: creates streams
- Torrent engine → Piece store: stores pieces
- Torrent engine → Torrent files: loads metadata
- Torrent engine → Torrent peers: downloads pieces
- API routes → Search API: dispatches search
- Search API → Torrent providers: queries providers
- Torrent providers → Search services: searches externally