Deploy Invidious

Privacy-respecting front-end for YouTube. Self-hosted, no ads, no tracking.

Deploy Invidious

Just deployed

/var/lib/postgresql/data

Just deployed

Invidious on Railway

One-click deploy of Invidious — a privacy-respecting, open-source front-end for YouTube — on Railway. Watch and search YouTube without ads, tracking, JavaScript, or a Google account.

Deploy on Railway

Live template:

What gets deployed

ServiceImageRole
Invidiousghcr.io/two-workspaces/invidious (upstream 2026.10.26-1c4b41f plus a restart wrapper)Web front-end on a public HTTPS domain (port 3000)
Companionquay.io/invidious/invidious-companion:2026.09.19-bb3b37fInternal-only stream extractor (port 8282)
Postgrespostgres:16-alpineStores accounts, subscriptions, watch history, playlists. 5 GB volume.

All three services run on Railway's private IPv6 network. Only Invidious is publicly exposed. Shared secrets (HMAC_KEY, INVIDIOUS_COMPANION_KEY, POSTGRES_PASSWORD) are auto-generated per deploy via Railway's ${{secret(N)}} template functions; cross-service references are resolved at deploy time.

Videos won't play after deploy?

Most common issue and not a bug in the template. YouTube blocks Railway's datacenter IPs from validating proof-of-origin (PO) tokens. Symptom: homepage works, but watch pages show "Companion is starting. Please wait until a valid potoken is found."

Quickest fix: add a YOUTUBE_SESSION_COOKIES env var to the Companion service, using cookies exported from a logged-in burner Google account. Three rules from yt-dlp's cookie export guide:

  1. Log in to YouTube in a private/incognito window
  2. Log out before closing the window — YouTube rotates cookies on session end and yours stop working otherwise
  3. Use a dedicated burner Google account; this approach can get accounts banned

Format the cookies as a single header string (SID=...; HSID=...; SSID=...; APISID=...; SAPISID=...; LOGIN_INFO=...) and paste into YOUTUBE_SESSION_COOKIES. Redeploy Companion. Watch pages should work within a minute or two.

If you have a residential proxy, an alternative is PROXY=http://user:pass@host:port on Companion. Datacenter proxies will be blocked the same way Railway's IPs are.

Full background: Invidious YouTube errors explained.

Customizing

Edit INVIDIOUS_CONFIG on the Invidious service. It's a YAML document — see the Invidious config reference. Don't edit the db:, hmac_key:, or invidious_companion: blocks — they're populated by ${{...}} references that resolve at deploy.

Invidious restarts itself every hour. Upstream says Invidious must be restarted often, ideally every hour. A small wrapper (source) does that, and restarts it sooner if it reaches 90% of its memory limit, so the container never goes down. A restart takes a few seconds. Change the interval with RESTART_EVERY (seconds) and the threshold with MEMORY_PCT on the Invidious service.

Images are pinned to tested upstream builds. Companion uses the upstream image directly: to move it, change its source image tag (tags are at quay.io/invidious/invidious-companion) and redeploy. Invidious is built from the FROM tag in this repo's Dockerfile (tags at quay.io/invidious/invidious). Bump it in your fork, or set the service's source image to an upstream tag if you don't need the hourly restart.

Troubleshooting

API and watch pages return 500 with "Youtube API returned status code 400" — YouTube changed its API and your deployed image is stale. Bump both the Invidious and Companion source image tags to the newest dated tags on quay.io and redeploy; the upstream projects track YouTube changes and a fresh image is usually the whole fix. (Video playback often keeps working while metadata breaks — that's the tell.)

Where to file issues

IssueWhere
Template wiring — Railway-specific config, references, secrets, healthcheckThis repo
Invidious bugs — UI, search, accounts, settingsiv-org/invidious
Companion bugs — video playback, PO tokensiv-org/invidious-companion
Railway platformRailway support

This template is just the deployment recipe. Application bugs go upstream.

License

Template wiring in this repo: MIT. Invidious and invidious-companion have their own licenses — see upstream projects.

Credits


Template Content

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
51
View Template
Foundry Virtual Tabletop
Self-hosted virtual tabletop for role-playing games (license required)

Lucas
71
View Template
NEW
Double Commander in your browser
The Double Commander file manager in the cloud, from any device

Nermin Sabanovic
0