How pyara-singh/bittorrent works
This repository combines a Go BitTorrent backend with a Tauri/React desktop shell. The backend’s demonstrated user workflow is HTTP torrent CRUD: the server registers routes, handlers validate requests, and an in-memory manager stores and returns torrent records. The tree also contains parsing, tracker, peer-transfer, scheduling, and storage subsystems, but the excerpts do not show them wired into that CRUD workflow. The frontend is still the default Tauri greeting screen, not a torrent client interface. The architecture of unsampled subsystems is represented without guessed connections.
Main entry points: main.go Server startup · routes.go HTTP routes · handlers.go CRUD handlers · torrent_parser.go Torrent parser
Components 30
HTTP backend
- Server startup
backend/cmd/app/main.go - HTTP routes
backend/internal/api/routes.go - CRUD handlers
backend/internal/api/handlers.go - Torrent manager
backend/internal/torrent/manager.go
Torrent metadata
- Torrent models
backend/internal/models/torrent.go - Magnet model
backend/internal/models/magnet.go - Torrent metadata
backend/internal/models/torrent_meta.go - Torrent parser
backend/internal/parser/torrent_parser.go - Magnet parser
backend/internal/parser/magnet_parser.go - Bencode decoder
backend/internal/bencode/decoder.go - Bencode encoder
backend/internal/bencode/encoder.go
BitTorrent transfer
- Peer model
backend/internal/models/peer.go - Tracker client
backend/internal/tracker/client.go - Download scheduler
backend/internal/download/scheduler.go - Torrent service
backend/internal/torrent/service.go - Torrent repository
backend/internal/torrent/repository.go - Piece downloader
backend/internal/torrent/downloader.go - Peer handshake
backend/internal/torrent/handshake.go - Peer connection
backend/internal/torrent/peer_connection.go - Peer client
backend/internal/torrent/client.go - Peer messages
backend/internal/torrent/message.go - Peer I/O
backend/internal/torrent/io.go - Piece work
backend/internal/torrent/piece_work.go - File store
backend/internal/storage/file_store.go - File writer
backend/internal/storage/writer.go
Desktop shell
- Desktop bootstrap
frontend/torrent-ui/src-tauri/src/main.rs - Tauri runtime
frontend/torrent-ui/src-tauri/src/lib.rs - React mount
frontend/torrent-ui/src/main.tsx - Greeting screen
frontend/torrent-ui/src/App.tsx
Other components
- HTTP client
Connections 14
- HTTP client → HTTP routes: sends requests
backend/internal/api/routes.go - Server startup → Torrent manager: creates
backend/cmd/app/main.go - Server startup → CRUD handlers: creates
backend/cmd/app/main.go - Server startup → HTTP routes: registers
backend/cmd/app/main.go - HTTP routes → CRUD handlers: dispatches to
backend/internal/api/routes.go - CRUD handlers → Torrent manager: reads and writes
backend/internal/api/handlers.go - Torrent parser → Bencode decoder: decodes with
backend/internal/parser/torrent_parser.go - Magnet parser → Magnet model: returns
backend/internal/parser/magnet_parser.go - Torrent parser → Torrent metadata: returns
backend/internal/parser/torrent_parser.go - Tracker client → Bencode decoder: decodes with
backend/internal/tracker/client.go - Tracker client → Peer model: returns
backend/internal/tracker/client.go - Peer client → Peer messages: formats messages
backend/internal/torrent/client.go - Desktop bootstrap → Tauri runtime: starts
frontend/torrent-ui/src-tauri/src/main.rs - React mount → Greeting screen: renders
frontend/torrent-ui/src/main.tsx