Skip to content

About

A multi users bittorrents client with a responsive web UI that quacks 🦆

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

TorrentsDuck2

Français · English · Deployment guide · Contributing · Apache 2.0

An open source, self-hosted platform for sharing torrents, files and server resources within a community.

TorrentsDuck2 brings members together around one server, one torrent engine and one shared library. Where individual seedboxes divide a server into separate user spaces, this project pools downloads and storage: every addition grows the library for all approved members.

The idea is a lively torrent commons: a community hub where everyone contributes to a shared space. Accounts and permissions control access; files and transfers belong to the collective library.

The project is the successor to TorrentsDuck, originally built with Meteor. This version uses Node.js 24+, Svelte 5, SvelteKit 3 and TypeScript, with Better Auth, PostgreSQL 17, qBittorrent, Nginx and FTPS. It is released under the Apache 2.0 license.

The entire project was orchestrated with OpenAI Sol 6.1 Ultra.

Features

  • Collective torrents: search and manage shared transfers through qBittorrent.
  • Shared library: browse, download and create revocable playback links, with VLC integration.
  • Studio: download a whole public YouTube video or a clip, assemble existing videos with titles and SRT subtitles, then download or share MP4, MKV or MP3 exports.
  • Web and FTPS access: the same file spaces, available to active, approved accounts.
  • Community administration: registration approval, account management and a dedicated permission for managing search sources.
  • TV sign-in: approve a QR code from a phone without typing a password on the TV.
  • Documented operations: Docker Compose, HTTPS/FTPS, encrypted backups and Meteor account migration.

One server, one shared library

Space Purpose Member access
downloads Files managed by qBittorrent Read and delete files and folders through the website and FTPS
share Files contributed by the community Read and write through the website and FTPS

Both spaces are collective. Removing a torrent keeps its files; deleting its data requires explicit confirmation and affects the whole community.

All active, approved members can also delete files and folders directly from downloads through the website and FTPS. Deletion is permanent for everyone; the website asks for confirmation. Uploads, renaming and folder creation remain forbidden there. Files still managed by qBittorrent may be reported missing or downloaded again.

Local Docker

With Docker, Compose and npm available, run from the repository root:

npm run local:up
npm run local:admin

local:up builds the images and starts the standalone compose.local.yaml configuration, without an .env file or host-side npm dependency installation. The PostgreSQL schema is initialized automatically. Open http://127.0.0.1:5180, then sign in with the test account admin and password local-admin-password (admin@example.com). local:admin creates this first administrator and refuses to modify a database that already contains users: run it only on the first launch.

The HTTP origin http://127.0.0.1:5180 is baked into the image at build time. To change this URL, update build.args.ORIGIN, ORIGIN, BETTER_AUTH_URL and the published port in compose.local.yaml, then rebuild with npm run local:up.

npm run local:logs  # Follow logs
npm run local:down  # Stop while keeping data
npm run local:up    # Rebuild and restart after code changes

Data remains in named volumes dedicated to this local stack, including after local:down. Only the website publishes a port, on 127.0.0.1:5180; PostgreSQL and qBittorrent RPC stay internal. Port 5180 and Docker subnet 172.30.20.0/24 must be available. Another TorrentsDuck2 stack cannot use this subnet at the same time; stopping its containers without releasing its network is not enough.

This configuration uses fictional credentials for local testing, without Nginx, FTPS or real email delivery. qBittorrent runs on an internal network without access to Internet peers or indexers: engine tests use test torrents, simulated search results and local API calls, without public downloads.

Usage

Accounts and approval

Registration is open. Each new account stays on a waiting page, without service access, until an administrator approves it. The address configured in ADMIN_EMAIL automatically receives the administrator role when registering; access is activated after email verification.

Under My account → Appearance, choose Original Duck, ASCII, 8-bit or Corporate. The choice applies immediately and is saved in the current browser. The sun/moon button switches light and dark mode for every theme.

TV sign-in

To connect a TV without entering a password on it, choose “Sign in with my phone” on the sign-in page. Scan the QR code, sign in on the phone if needed, compare the code on both screens, then approve the connection. The QR code expires after five minutes and can only be used once. Only approve requests started on your own device. Signing out on one device closes all web sessions for the account, including the TV, and cancels approved QR codes that have not yet been used. Open screens detect the sign-out within a few seconds when their network connection is available. Both devices must be able to reach the same site address, using HTTPS in production.

Streaming view

In Files → Streaming, videos from the selected space (downloads or share), including subfolders, appear newest first. Sorting uses the creation date reported by the filesystem, or its metadata-change date when unavailable; copying or restoring files may therefore change the order. Clicking a poster creates a revocable link and attempts to open VLC on mobile; desktop browsers download a playlist whose opening depends on .m3u files being associated with VLC. Browsers may ask for permission or block opening the app; the dialog keeps the playback link and VLC actions available.

Posters come from TMDB when TMDB_READ_ACCESS_TOKEN is configured on the server. Obtain an API Read Access Token from your TMDB account API settings, then restart the web service. Movie searches use filenames, so matches can be missing or incorrect. Without a token, a match or a working provider, a generic poster is used. Images and unsuccessful searches are cached in DATA_ROOT/cache/covers, outside the shared spaces; browsers do not contact TMDB. Local Docker stores this cache in its named cache volume; supply the token through the environment before npm run local:up to enable posters.

The explorer displays the whole folder without pagination. Date and name sorting interleave folders and files according to the selected value.

Folder ZIP downloads

In Files, choose Download folder as ZIP next to a folder or from inside it. The browser downloads an archive with its files and subfolders, including empty folders. The server builds the ZIP as it sends it, without storing a temporary copy.

VLC playback

In the file browser, “Open in VLC” prepares a revocable playback link valid for six hours. On Android, iPhone and iPad, then tap the dialog's “Open in VLC” button to pass the media to the installed app; the browser may ask for confirmation. The website cannot check whether VLC is installed. Copying the link and downloading the playlist remain available, including on desktop or when the browser blocks opening the app.

Copied playback links end with the original filename and extension (/api/files/play/<token>/Movie.mkv) so download clients can read the name from the URL. Use the dialog's Copy button to paste this link into an external player or download client such as Freebox Files. Links still expire after six hours, and existing links without a filename remain valid until they expire or are revoked.

The web player's Audio track selector lists a MKV's languages and track names. On desktop, including Brave, changing tracks keeps the current position, pause state and volume so you can check a French dub's synchronization. Tracks whose audio codec the browser cannot decode require VLC; VLC is also recommended on phones and tablets. Selection changes only the streamed MKV headers, without modifying the shared file or re-encoding its media. Unusual MKV headers that cannot be read safely also fall back to VLC.

Studio

Open Studio, or choose Create a clip in the library. Follow the three sections: add videos, choose passages, then export. A project assembles passages from one or several existing videos on a single track, up to five minutes in total. Browse the entire source with the seek slider or the ±10-second buttons, then mark the start and end of each passage. Play clip previews only the selected passage. Choose 16:9 or 9:16; collapsible sections hold optional audio, crop and title settings, thumbnails and SRT subtitles. Imported subtitles use the final montage timeline and are burned into the exported image.

Projects, previews and exports are private. Choose MP4 or MKV for the 1080p H.264/AAC montage, or MP3 for audio only. Download the result or explicitly share a finished copy with the community: the published file belongs to share, with its existing collective permissions. Sources remain unchanged. Unsupported browser formats can use a low-resolution preview of the selected passages, prepared on demand.

The YouTube section downloads a whole public video or extracts a passage of up to five minutes, independently of the montage. Paste a single-video URL, choose the whole video or enter start and end times in seconds, then choose MP4, MKV or MP3 (audio only). Video exports can keep the source framing or use 16:9 or 9:16. Results remain private and appear in the task list for download. To reuse a downloaded video in a montage, explicitly publish it to share, then add it from the library. Playlists and live streams are unsupported. Even a short clip downloads the source first; the 10 GiB transfer limit still applies.

To add a French soundtrack to a whole film, select its source in Studio, enter the public YouTube link in the French audio section, then choose Download YouTube audio. This first task prepares a private AAC/M4A soundtrack. The dual player then shows the whole source video with the downloaded audio underneath: play, pause and seek both tracks together, slow playback down and adjust the offset in 0.01- or 0.1-second steps, or enter a precise value from −600 to +600 seconds. Positive values delay French audio and negative values advance it. The source video must be playable in your browser for this alignment step. Choose Create movie with this alignment once satisfied; the export reuses the prepared audio without downloading it again and creates a private MKV with the original video copied without re-encoding, the original audio retained and French selected by default. This operation uses the whole film, independently of the montage and its five-minute limit. Both copies must use the same cut; a fixed offset cannot repair missing scenes or a gradually drifting soundtrack. Download the MKV for VLC or explicitly publish it to share.

The separate studio service processes one task at a time, limited initially to one CPU and 4 GiB. Queued tasks persist across restarts; interrupted tasks fail and can be restarted. The 10% disk reserve also applies to the private studio volume. The deployment guide covers storage, performance checks and backup limits. There is no automatic transcription or direct YouTube/TikTok publishing.

Search and sources

The Search page finds torrents and adds them to collective transfers. The initial catalogue includes The Pirate Bay, Torrents CSV, Nyaa.si and LimeTorrents; Snowfl is available as an optional installation. An administrator can grant selected members the additional “Source manager” permission to install, enable, disable or remove catalogue plugins. The pinned versions are bundled in the qBittorrent image, and their sources and licenses are kept in the repository. External indexer availability may vary.

Source managers can also add a source by URL, with detection of JSON, RSS/Atom/Torznab, or HTML containing recognized magnets, torrent files or hashes. Use {query} for keywords, or a fixed list or feed filtered by name. Optional HTTP Basic, Bearer or X-Api-Key authentication requires HTTPS. URLs and credentials are encrypted on the server; sources and their access are shared among approved members. If detection fails, copy the detection report from Sources or Search when requesting a new adapter. See the limits and procedure. Apply db:migrate on an existing installation to create search_sources.

Sorting by seeders, leechers, newest date, size or name, and filtering by minimum seeders and size, happen before pagination over a maximum of 2,000 results; reaching the limit is reported. Search can target one source or all active sources. Dates not provided by the engine remain unknown; Snowfl and LimeTorrents dates are approximate when available.

Search keeps the last query, source, visible results, filters and page in this browser's local storage, separately for each account. They are restored after navigation or a reload, without starting another search. Server search jobs still expire after five minutes: cached results remain visible, but pagination, filters and additions from URL sources require a new search once the job expires. Nothing is synchronized between browsers; clearing site data removes the saved state.

Transfer gauges

Transfer gauges use the peak download and upload rates observed by the server. These two maxima are stored in a single PostgreSQL row shared by all browsers and are only replaced when exceeded; no speed history is recorded. On an existing installation, apply the schema with the db:migrate command below before restarting the new version.

Development

Node.js 24+, PostgreSQL 17 and a qBittorrent instance are required. Copy .env.example to .env, choose secrets, and configure DATABASE_URL, QBT_URL, ORIGIN and local paths.

For email, set MAILGUN_API_KEY, MAILGUN_DOMAIN (a verified Mailgun domain), MAILGUN_FROM (for example TorrentsDuck2 <noreply@mg.example.com>) and MAILGUN_API_URL: https://api.mailgun.net for a US domain or https://api.eu.mailgun.net for an EU domain. Password reset, verification and registration notification emails use the Mailgun API. Without a Mailgun key, configure SMTP_HOST, SMTP_PORT, SMTP_SECURE, SMTP_USER, SMTP_PASSWORD and SMTP_FROM in .env. Each registration notifies active, approved administrators with a link to /admin; if there is no active administrator, the email is sent to ADMIN_EMAIL when configured. Delivery failures are logged without cancelling registration. Keep keys and passwords in .env, never in Git.

Set ADMIN_EMAIL=admin@example.com to automatically assign the admin role when that account is created, using a case-insensitive address match. The emailed verification link activates access; the waiting page can resend it if delivery fails or the link expires. Other accounts still require administrator approval. An empty value disables automatic assignment; changing the variable does not modify existing accounts.

In Administration, the Pending tab lists unapproved accounts with their email addresses and an Approve action. Approval does not require email verification, so a fictitious address is accepted; that address cannot receive password reset emails. Approved accounts appear in Members.

Delete all permanently removes all accounts awaiting administrator approval after explicit confirmation, including those hidden by the search. Approved accounts are preserved even if their email address is unverified. Sessions and playback links belonging to deleted accounts are removed; shared files, transfers and messages are preserved.

npm ci
node --env-file=.env --run db:migrate
npm run dev

For local files, set DATA_ROOT=./data, DOWNLOADS_DIR=./data/downloads, SHARE_DIR=./data/share and FILE_DELIVERY=node, then create those directories. Set ORIGIN and BETTER_AUTH_URL to http://127.0.0.1:5173, and point DATABASE_URL at the PostgreSQL port published on the host (postgres is an internal Docker hostname). npm run dev loads .env automatically at startup; restart the server after changing this file. Create the initial administrator with node --env-file=.env --run admin:create and the ADMIN_USERNAME, ADMIN_EMAIL, ADMIN_PASSWORD variables. If migrating Meteor accounts, import them before creating this account: the import requires an empty user table.

For host-side Studio development, also set STUDIO_DIR=./data/studio and create this directory. Install FFmpeg 6.1+ with libass/fontconfig and DejaVu Sans, plus Python 3.11+ and yt-dlp[default]==2026.10.26 in a Python virtual environment whose bin directory is on PATH. Node 24 supplies the JavaScript runtime required by yt-dlp. Then run node --env-file=.env --import tsx scripts/studio-worker.ts alongside the web server. The local Docker stack includes these tools, the worker and its own persistent studio volume. Studio has outbound access for public YouTube video and audio; qBittorrent remains on its internal test network. Native media tests run when FFmpeg/FFprobe are available; worker lifecycle tests also require TEST_DATABASE_URL pointing to a dedicated test database.

Checks

npm run check
npm test
npm run build
python3 deploy/test_services.py
node --test scripts/backup.test.mjs
python3 scripts/backup-ftp.test.py
docker compose --env-file .env.example config --no-env-resolution -q

npm test runs tests/**/*.test.ts. Set TEST_DATABASE_URL to a dedicated test database to include PostgreSQL tests; without it, they are skipped. Run the full HTTP flow separately with node --test tests/http-flow.test.mjs, setting HTTP_BASE_URL, HTTP_ADMIN_LOGIN and HTTP_ADMIN_PASSWORD for a local instance and test administrator. These tests write data: never point them at production.

Deployment and account migration

Follow the Ubuntu 24.04 LTS and Docker deployment guide in English or French, then the Meteor migration and backup guide (French) if needed. Installation covers ports, secrets, PostgreSQL, HTTPS/FTPS certificates, the first administrator, backups and updates. No script reformats a disk, and no SSH credentials are bundled. PostgreSQL and qBittorrent RPC do not publish ports. HTTP downloads require session authorization before Nginx serves the files.

Both spaces are collective: qBittorrent manages downloads, which active, approved members can read and delete from through the website and FTPS; share is writable through both. Explicit FTPS uses port 21000 and requires TLS for commands and data.

An optional encrypted FTP backup can run directly from the server every night, without a Mac running: it includes the full PostgreSQL database and configuration, followed by files from share that fit within the quota, starting with the smallest. It is disabled by default; the backup guide (French) describes age keys, the 100 GB quota, retention and restoration. Downloads and qBittorrent state remain excluded.

Validate the images and server behavior with the guide's checks before opening access. Files and historical torrents from the old server are not included in account migration.

Contributing

Issues and pull requests are welcome for reproducible problems or focused improvements. Run the checks above before proposing a change. Use fictional data in examples, screenshots and logs; keep production domains, backups, keys and .env files out of the repository.

License

Released under the Apache 2.0 license, like the original TorrentsDuck project. Third-party search plugins retain their BSD, MIT or GPL licenses, included alongside their sources.

About

A multi users bittorrents client with a responsive web UI that quacks 🦆

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages