Deploy PostgreSQL19
Postgres19 + pgvector with SSL on by default
Just deployed
/var/lib/postgresql
Deploy and Host PostgreSQL 19 + pgvector on Railway
PostgreSQL 19.0 with pgvector 0.8.7 preinstalled, ready to deploy on Railway. The template started on its own PGDG-built image on release day, before the official image existed, and has been rechecked since, now on the pgvector project's official image.
About Hosting PostgreSQL 19 + pgvector
PostgreSQL 19.0 with pgvector 0.8.7 preinstalled, on the pgvector project's official image, pinned by digest. A persistent volume keeps data between restarts, and the pgvector extension is enabled at first start. No replication or high availability.
SSL is on by default with a self-signed certificate, dump import is supported on first boot through POSTGRES_INIT_DUMP_URL.
Scheduled backups are available as an optional add-on: the project repository includes a small backup service (services/backup) you can deploy alongside the database. It runs pg_dump daily into a Railway Bucket, and it was verified live, including a restore drill, while it shipped with this template.
Live verified on Railway on 23 November 2026: a fresh deploy of this exact template was checked end to end, from a zero click deploy to a pgvector query over a TLS connection. Deploys in about two minutes, and a 60 MB database, 400 MB volume, and about 1 GB memory are enough to start.
How to connect
From another service in the same project, reference the database with ${{Postgres.DATABASE_URL}}. For tools outside Railway, use ${{Postgres.DATABASE_PUBLIC_URL}}, which routes through the TCP proxy this template enables. PGURL and the standard PG* variables are provided too.
The vector extension is already created in your database:
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3)); INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]'); SELECT * FROM items ORDER BY embedding <=> '[3,1,2]' LIMIT 5;
SSL
SSL is on by default with a self-signed certificate. The certificate is generated once, kept on the volume, and valid for 3,650 days (10 years), so there is no renewal step. Add ?sslmode=require to your connection string for an encrypted connection; most drivers work with that as is. Clients set to verify-full (the default in some drivers, including Prisma without parameters and psycopg) cannot validate a self-signed certificate: use sslmode=require, or set PG_SSL=off on the Postgres service if you do not need TLS.
What runs in your project
One service: the database, with its persistent volume. Nothing else runs in your project.
Common Use Cases
- Store application data in PostgreSQL 19 with a persistent volume.
- Run vector similarity search with pgvector for AI embeddings and retrieval.
- Use as the database for applications that need relational data plus vector search.
Dependencies for PostgreSQL 19 + pgvector Hosting
- A Railway account and project to deploy the template into.
- The service builds its image from the template's GitHub repository Dockerfile, so no external Docker Hub access is required.
Why Deploy PostgreSQL 19 + pgvector 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, scaling, or server management. It's the ideal place to host PostgreSQL 19 + pgvector.
By deploying PostgreSQL 19 + pgvector on Railway, you are one step closer to supporting a complete full-stack application with minimal burden.
Template Content
