The OpenTubeX web app is the same app as the web demo, and you can run it on your own server with Podman or Docker. The setup includes an Invidious server, so searches, channel pages, and thumbnails load through your server instead of from YouTube or a public Invidious instance. Videos also load through it while Proxy Videos Through Invidious is on. With that setting off, the browser loads videos directly from YouTube.
Your library stays in each browser, as in the web demo. The server does not store subscriptions, history, or playlists. To share them between browsers and devices, sync them.
Before you start
You need a computer that runs Podman or Docker. On Linux, use Podman. It runs the server without root access, while anyone who can run Docker commands can gain root access to the computer. podman compose also needs podman-compose or Docker Compose installed. If Docker Compose is installed, podman compose runs it, and Docker Compose connects to Podman through a socket. On Linux, turn the socket on with systemctl --user enable --now podman.socket.
This guide uses podman compose. With Docker, type docker compose instead in every command.
Browsers only store the library on HTTPS addresses and on localhost. On a plain http:// address, OpenTubeX can’t open the library and doesn’t work. To use it from other devices, give the server an HTTPS address as described in Open it from other devices.
Start the server
-
Create a folder for the server and download the Compose file into it:
Terminal window mkdir opentubex && cd opentubexcurl -O https://raw.githubusercontent.com/OpenTubeX/OpenTubeX/development/docker/compose.yaml -
Create a
.envfile next to it with two different random keys. Invidious uses them to sign its data and to talk to the part of the server that loads videos:Terminal window echo "INVIDIOUS_HMAC_KEY=$(openssl rand -hex 8)" >> .envecho "INVIDIOUS_COMPANION_KEY=$(openssl rand -hex 8)" >> .env -
Start it:
Terminal window podman compose up -d -
Open
http://localhost:8080in a browser on the same computer.
The server needs about a minute after the first start before videos play. Until then, pages load but videos show an error.
On Linux, Podman can stop the server when you log out, and it doesn’t start the server again after a reboot. To keep it running and start it when the computer boots, run:
systemctl --user enable podman-restart.serviceloginctl enable-lingerTo use a different port, add OPENTUBEX_PORT=8081 to .env and run podman compose up -d again. Browsers keep a separate library for each address, including its port, so back up your library or sync it before you switch to another port or address.
Open it from other devices
The server only accepts connections from the computer it runs on. Put an HTTPS service in front of its port to reach it from other devices. The examples use port 8080. If you changed OPENTUBEX_PORT, use that port instead:
-
Tailscale keeps the server private to your own devices. Run
tailscale serve --bg 8080on the server, then open thehttps://….ts.netaddress it prints on any device in your tailnet. -
Cloudflare Tunnel gives the server a public address without opening ports. Point a tunnel at
http://localhost:8080, and protect the address with Cloudflare Access so that only you can use it. -
A reverse proxy such as Caddy works with your own domain. Caddy obtains a certificate on its own:
Terminal window opentubex.example.com {reverse_proxy localhost:8080}
Anyone who can reach the address can use your server. With a public address, limit access with Cloudflare Access, your reverse proxy’s authentication, or a firewall, so that strangers can’t use your server’s connection to YouTube.
Update
Download the latest images and restart:
podman compose pullpodman compose up -dThe latest image follows stable releases. To try nightly builds, change ghcr.io/opentubex/opentubex-web:latest in compose.yaml to ghcr.io/opentubex/opentubex-web:nightly.
Use the Local API
Browsers don’t let web pages read YouTube’s responses, so the web app has no Local API on its own. The OpenTubeX Local API extension lets it request YouTube directly from your browser, as the desktop and mobile apps do. Each browser that opens the web app needs the extension:
- Install the extension as its README describes. It isn’t in the browser add-on stores yet.
- If you open OpenTubeX on an address other than
localhost, open the extension’s options and add thathttps://address. - Reload OpenTubeX.
- If you picked Invidious or a Yattee server as Preferred API Backend earlier, OpenTubeX keeps using it. Change it to Local API in the Video and metadata providers settings.
OpenTubeX then uses the Local API, and falls back to your Invidious server when Fallback to Non-Preferred Backend is on. YouTube receives these requests from your browser’s IP address, not your server’s.
Run it without Invidious
With the extension in every browser you use, the server doesn’t need Invidious. Download the smaller Compose file instead of compose.yaml, and start it:
mkdir opentubex && cd opentubexcurl -O https://raw.githubusercontent.com/OpenTubeX/OpenTubeX/development/docker/compose.without-invidious.yamlpodman compose -f compose.without-invidious.yaml up -dIt needs no .env keys. Browsers without the extension use public Invidious instances instead, as in the web demo. Add -f compose.without-invidious.yaml to the other podman compose commands in this guide too, such as when you change the port or update.
Limitations
Without the extension, the web app has no Local API, as in the web demo. It can’t fall back to YouTube when Invidious fails, and features that need the Local API are missing. Choose a content provider explains what each provider supports.
YouTube sometimes blocks Invidious servers that make many requests. If videos stop playing for everyone, restarting the server with podman compose restart can help. The Invidious documentation explains common YouTube errors.