---
title: "Deploy Vaultwarden with PostgreSQL on Railway"
description: "Vaultwarden on Railway with PostgreSQL and persistent /data storage."
category: "Authentication"
url: https://railway.com/deploy/vaultwarden-with-postgresql-on-railway
---

# Deploy Vaultwarden with PostgreSQL on Railway

Vaultwarden on Railway with PostgreSQL and persistent /data storage.

**[Deploy Vaultwarden with PostgreSQL on Railway on Railway](https://railway.com/template/vaultwarden-with-postgresql-on-railway)**

- **Creator:** youta's Projects
- **Category:** Authentication
- **Total deploys:** 8

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### vaultwarden

- **Image:** vaultwarden/server:1.35.4
- **Health check:** /alive

## Documentation

# 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


## Similar templates

- [Keycloak](https://railway.com/deploy/mSwigX) — Keycloak template with keywind theme + apple and discord providers
- [lua-protector](https://railway.com/deploy/lua-protector) — Test deployed my project first
- [bknd](https://railway.com/deploy/p4nTYL) — Feature-rich yet lightweight backend

Open this page in a browser: https://railway.com/deploy/vaultwarden-with-postgresql-on-railway
