
Deploy pgAdmin — PostgreSQL Admin & Query Tool
Self-host pgAdmin — web GUI to manage your PostgreSQL databases
pgadmin
Just deployed
Deploy and Host pgAdmin on Railway
pgAdmin is the most popular open-source admin and management tool for PostgreSQL — a full web interface for running queries, browsing and editing schemas, managing roles, monitoring performance, and handling backups and restores, all from your browser. This template deploys pgAdmin 4 on Railway with the port wired correctly and your saved server connections persisted on a volume, so it's reachable on first deploy and doesn't forget your databases every time you redeploy.
What This Template Deploys
| Service | Purpose |
|---|---|
| pgAdmin 4 | The PostgreSQL web admin interface — query tool, schema editor, and dashboards |
A single lightweight service. A persistent volume holds pgAdmin's configuration and your registered server connections, so they survive redeploys. pgAdmin is an interface only — it connects to PostgreSQL databases you already run.
About Hosting
pgAdmin is simple to run, but two Railway-specific details separate a template that just works from one that frustrates — both handled here.
pgAdmin is an interface, not a database. This is the key thing to understand: pgAdmin does not include a PostgreSQL server. It's a management GUI that connects to databases you already have — a Railway PostgreSQL service or any external PostgreSQL instance. After logging in, you register a server with its host, port, database, username, and password (for a Railway Postgres service, pull these from its DATABASE_URL).
The port must be wired to Railway's PORT, or it's unreachable. pgAdmin listens on port 80 by default, but Railway assigns a port via the PORT variable and routes to it. If pgAdmin isn't told to listen on that port, Railway can't reach the container and it looks broken. This template sets PGADMIN_LISTEN_PORT=${{PORT}} and PGADMIN_LISTEN_ADDRESS=0.0.0.0 so it's reachable immediately — the number-one pgAdmin-on-Railway failure, solved.
Your saved connections persist on a volume — no re-registering every deploy. By default pgAdmin stores server definitions inside the container, so a redeploy wipes them and you re-add every database by hand. This template attaches a volume for pgAdmin's config directory (/var/lib/pgadmin) so your registered servers, query history, and preferences survive redeploys — the difference that makes it usable day to day.
Postfix is disabled. PGADMIN_DISABLE_POSTFIX=true stops pgAdmin from launching its built-in mail server, which isn't needed on Railway. Configure external SMTP later if you want password-reset emails.
Secure it — it can reach your databases. pgAdmin logs in with PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD. Since it holds connections to your databases, set a strong password and keep the instance access-controlled. Railway's automatic HTTPS encrypts the session.
Typical cost: ~$5/month on Railway for the single lightweight service. pgAdmin is free and open source under the PostgreSQL License, with no paid tiers.
How It Compares
| pgAdmin (self-hosted) | TablePlus / DBeaver | Adminer | psql (CLI) | |
|---|---|---|---|---|
| Access | Browser, anywhere | Desktop app | Browser | Terminal |
| Postgres-specialized | Deeply | Multi-DB | Multi-DB | Yes |
| Feature depth | Full (roles, dashboards, backup) | High | Basic | Full |
| Team access | Shared instance | Per-desktop | Shared | Per-user |
| Self-hostable | Yes | N/A (local) | Yes | N/A |
| Cost | Free | Free/paid | Free | Free |
Desktop tools like TablePlus and DBeaver are powerful but installed per machine. Adminer is a lighter single-file browser tool. psql is the CLI. pgAdmin's strength is being the deep, PostgreSQL-specialized web interface — full role management, performance dashboards, and backup tools — hosted once and reachable from any browser, ideal for a shared team database console.
Deploy in Under 5 Minutes
- Click Deploy on Railway — pgAdmin builds automatically (~2 minutes)
- Set
PGADMIN_DEFAULT_EMAILand a strongPGADMIN_DEFAULT_PASSWORD - Confirm the volume is mounted and the port is wired to Railway's
PORT - Open your Railway domain and log in with those credentials
- Register your PostgreSQL server (Servers → Register), using details from its
DATABASE_URL
For a Railway Postgres service, connect over the private network using its internal host and port.
Common Use Cases
- Web-based database console — run queries and manage PostgreSQL from any browser, no desktop install
- Manage a Railway Postgres service — a full GUI in front of the database backing your app
- Team database access — one shared, access-controlled console instead of everyone installing a desktop tool
- Query development and debugging — the SQL query tool with explain plans and results grids
- Backup and restore — manage PostgreSQL dumps and restores through the interface
Configuration
| Variable | Required | Description |
|---|---|---|
PGADMIN_DEFAULT_EMAIL | Required | Login email for the initial admin account |
PGADMIN_DEFAULT_PASSWORD | Required | Login password — set a strong value |
PGADMIN_LISTEN_PORT | Pre-set | ${{PORT}} — wired to Railway's injected port so it's reachable |
PGADMIN_LISTEN_ADDRESS | Pre-set | 0.0.0.0 — accept connections so Railway can route to it |
PGADMIN_DISABLE_POSTFIX | Pre-set | true — skips the built-in mail server |
PGADMIN_CONFIG_SERVER_MODE | Pre-set | True — multi-user mode with config on the volume |
Wire the port and persist the volume.
PGADMIN_LISTEN_PORTmust be Railway'sPORTor the interface is unreachable, and the/var/lib/pgadminvolume keeps your registered servers across redeploys. Both are handled here — the two things that break or frustrate naive deploys.
pgAdmin has no database — connect one. It's a management interface only. Register a Railway PostgreSQL service or external instance after login. Set a strong admin password, since pgAdmin holds credentials to your databases.
Dependencies for pgAdmin Hosting
- Railway account — ~$5/month for the single lightweight service
- A PostgreSQL database to manage (a Railway Postgres service or external instance)
- A persistent Railway volume for pgAdmin's config and saved connections (included)
- Optional: external SMTP for password-reset emails
Deployment Dependencies
- pgAdmin Official Site
- pgAdmin Container Deployment Docs
- pgAdmin Docker Image
- Railway PostgreSQL Documentation
Implementation Details
The template runs the official dpage/pgadmin4 image as a single service. Because pgAdmin defaults to port 80 while Railway routes to an injected PORT, the template sets PGADMIN_LISTEN_PORT to Railway's port and PGADMIN_LISTEN_ADDRESS to 0.0.0.0, so the interface is reachable on first deploy — the most common cause of a "deployed but can't open it" pgAdmin issue.
pgAdmin stores its configuration and registered server definitions in a SQLite config database under /var/lib/pgadmin. By default that lives inside the container and is lost on redeploy, so the template mounts a persistent volume there and enables PGADMIN_CONFIG_SERVER_MODE=True, preserving your servers, query history, and preferences across deployments. PGADMIN_DISABLE_POSTFIX=true prevents the built-in mail server from starting, since Railway deployments use external SMTP if email is needed.
pgAdmin is a client interface only and holds no database of its own; it connects to PostgreSQL instances you register, ideally over Railway's private network for a Railway Postgres service. The admin login is set via PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD, and Railway provides automatic HTTPS.
Frequently Asked Questions
Does pgAdmin include a database? No — it's a management interface only. You connect it to a PostgreSQL database you already run, such as a Railway Postgres service or an external instance, by registering the server after login.
Why couldn't I open pgAdmin after deploying? Almost always the port. pgAdmin defaults to port 80, but Railway routes to its injected PORT. This template wires PGADMIN_LISTEN_PORT to that port so it's reachable — the top pgAdmin-on-Railway issue.
Do my saved server connections survive a redeploy? Yes, with this template — it persists pgAdmin's config on a volume. By default pgAdmin loses them on redeploy, forcing you to re-register every database; the volume fixes that.
How do I connect to my Railway Postgres? After login, go to Servers → Register → Server and enter the host, port, database, user, and password from your Postgres service's DATABASE_URL. Use the private network host for a Railway database.
Is it secure? pgAdmin holds credentials to your databases, so set a strong admin password and keep the instance access-controlled. Railway's automatic HTTPS encrypts the connection.
Is pgAdmin free? Yes, fully open source under the PostgreSQL License, with no paid tiers or usage limits. You pay only for Railway infrastructure.
Why Deploy pgAdmin 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 pgAdmin on Railway you get a browser-based PostgreSQL console with the setup done right — the port wired so it's reachable, your saved connections persisted on a volume, Postfix disabled, and automatic HTTPS. Manage any PostgreSQL database from anywhere, on infrastructure you own.
Template Content
pgadmin
dpage/pgadmin4PGADMIN_DEFAULT_EMAIL
Email address used when setting up the initial administrator account to login to pgAdmin.
PGADMIN_DEFAULT_PASSWORD
Password used when setting up the initial administrator account to login to pgAdmin.