Deploy Invidious
Privacy-respecting front-end for YouTube. Self-hosted, no ads, no tracking.
Companion
Just deployed
Postgres
Just deployed
/var/lib/postgresql/data
Invidious
Just deployed
Deploy and Host Invidious on Railway
Invidious is a privacy-respecting, open-source front-end for YouTube. It lets you watch and search videos without ads, tracking, JavaScript, or a Google account. This template provisions a complete stack — front-end, companion stream extractor, and Postgres database — ready to deploy in one click.
About Hosting Invidious
Self-hosting Invidious gives you a private alternative to YouTube's site, with no telemetry sent to Google. Subscriptions, watch history, and playlists live in your own database. This template deploys three services on Railway's private network: the Invidious web app, an invidious-companion sidecar that handles video stream extraction, and a Postgres database with persistent storage. Railway auto-injects fresh secrets and resolves cross-service references at deploy time, so each new template instance gets unique credentials with no manual setup. Most users will need to add YouTube cookies on the Companion service after first deploy — see Implementation Details below.
Common Use Cases
- A personal, ad-free YouTube viewing instance accessible from any device
- A shared instance for family or friends to browse without Google sign-ins
- Privacy-respecting research and content discovery without leaving a Google footprint
- An API backend for embedding YouTube content into your own applications
Dependencies for Invidious Hosting
- A PostgreSQL 16 database for user accounts, subscriptions, and watch history
- An invidious-companion sidecar service for video stream extraction
- Optionally, YouTube cookies from a logged-in burner Google account, required for video playback when YouTube blocks the Railway egress IP from validating proof-of-origin tokens
Deployment Dependencies
- Invidious — upstream project
- Invidious Companion — stream extractor
- Invidious docs, including YouTube errors explained for diagnosing playback failures
- yt-dlp cookie export guide — safe procedure for exporting YouTube cookies into Companion's
YOUTUBE_SESSION_COOKIES
Implementation Details
The three services communicate over Railway's private IPv6 network — neither Postgres nor Companion is publicly exposed. Companion's API is reached via path-prefixed URLs (http://companion.railway.internal:8282/companion); Invidious's INVIDIOUS_CONFIG YAML wires this automatically. All
shared secrets — HMAC_KEY, INVIDIOUS_COMPANION_KEY, and POSTGRES_PASSWORD — are auto-generated per deploy via ${{secret(N)}} template functions. Companion's SERVER_SECRET_KEY references ${{Invidious.INVIDIOUS_COMPANION_KEY}}, so the two services share a key without it being stored
twice.
If watch pages return "Companion is starting. Please wait until a valid potoken is found", YouTube has rate-limited Railway's egress IP. Set YOUTUBE_SESSION_COOKIES on the Companion service using a cookie string from a logged-in burner Google account (see the yt-dlp guide linked above).
Alternatively, set PROXY=http://user:pass@host:port if you have a residential proxy.
Why Deploy Invidious on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Invidious on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
Postgres
postgres:16-alpineInvidious
quay.io/invidious/invidious:latest