Railway

Deploy Vaultwarden with PostgreSQL on Railway

Vaultwarden on Railway with PostgreSQL and persistent /data storage.

Deploy Vaultwarden with PostgreSQL on Railway

/var/lib/postgresql/data

Just deployed

/data

Deploy and Host Vaultwarden with PostgreSQL on Railway

About Hosting

Vaultwarden is a lightweight, self-hostable password manager compatible with Bitwarden clients. This template deploys Vaultwarden on Railway with PostgreSQL for persistent application data and a mounted /data volume for filesystem-backed storage such as attachments.

Railway works well for this setup because it provides managed networking, persistent storage, PostgreSQL, and a generated public domain without requiring you to build the infrastructure stack manually.

Why Deploy Vaultwarden with PostgreSQL on Railway?

This template gives you a practical two-service Vaultwarden setup using the official vaultwarden/server:1.35.4 image. It is intended for users who want a persistent Railway deployment with PostgreSQL and a mounted /data volume.

It is also designed to work correctly before you configure a custom domain. You can deploy first, generate a Railway public domain, and then set DOMAIN afterwards.

Common Use Cases

  • Self-hosting a personal or family password manager
  • Running Vaultwarden with PostgreSQL instead of SQLite
  • Deploying a persistent Vaultwarden instance on Railway
  • Starting with a Railway-generated domain and adding a custom domain later

Dependencies for Deployment

Deployment Dependencies

This template includes:

  • A vaultwarden service running the official vaultwarden/server:1.35.4 Docker image
  • A Postgres service for persistent application data
  • A persistent /data volume attached to Vaultwarden
  • A healthcheck path using /alive

Configuration Dependencies

During setup you will provide:

  • ADMIN_TOKEN

The template also configures:

  • SIGNUPS_ALLOWED=false
  • DATABASE_URL=postgresql://${{Postgres.PGUSER}}:${{Postgres.PGPASSWORD}}@${{Postgres.RAILWAY_PRIVATE_DOMAIN}}:${{Postgres.PGPORT}}/${{Postgres.PGDATABASE}}

Deploy and Host

Deploy the template first, then generate a Railway public domain for the vaultwarden service.

After Railway assigns the public hostname, set:

DOMAIN=https://

Do not set DOMAIN before the service has a generated Railway domain. If DOMAIN is set too early, Vaultwarden may fail startup with an empty-host validation error.

After deployment, verify:

  • the vaultwarden service is using port 80
  • /alive responds successfully
  • /data is mounted
  • the PostgreSQL service remains private-only

Template Content

More templates in this category

View Template
Keycloak
Keycloak template with keywind theme + apple and discord providers

beuz
View Template
lua-protector
Test deployed my project first

trianaq765-cmd's Project
View Template
bknd
Feature-rich yet lightweight backend