Postgres backups and point-in-time recovery on Railway
Short answer: to restore Postgres on Railway to a point in time, run a Postgres that archives its write-ahead log (WAL) to storage and takes regular base backups. The Tracklayer PITR template does this from the first boot, with a Railway Bucket for the archive, a health-check cron job and a restore slot you drive with one variable. If scheduled dumps and a restore button are enough for you, Databasus is a simpler option for backing up several databases.
Deploy Postgres with PITR on RailwayWhen this makes sense
Daily dumps can lose a day of data, and they cannot bring back the state just before a bad migration or an accidental DELETE. Point-in-time recovery (PITR) can. Per the template documentation, typical uses are:
- undoing an accidental
DELETE,UPDATEorDROPby restoring to a minute before, then copying the rows back, - recovering from a lost or damaged volume while losing at most about a minute of writes,
- inspecting data as it was at a given time, without touching production,
- running restore drills to prove that backups work.
Postgres templates people deploy on Railway
| Template | Creator | Deployments | Services |
|---|---|---|---|
| PostgreSQL | Railway Templates | 394,257 | 1 |
| n8n | Thalles Passos's Projects | 5,850 | 2 |
| Langflow | – | 2,852 | 2 |
| pgvector | Brody's Projects | 2,077 | 1 |
| PostGIS | Railway Templates | 1,505 | 1 |
| n8n | Bruno's Team | 1,293 | 2 |
| ExpressJS PostgreSQL | opqr's Projects | 1,101 | 2 |
| medusajs ecommerce Nextjs, Postgres, Redis | Rasmus Puls's Projects | 1,036 | 4 |
Railway marketplace data as of 2026-11-19. Full ranking: Best PostgreSQL templates on Railway.
Check each template’s services and volumes. A plain Postgres template does not include backups by itself.
Two approaches
| Postgres with PITR | Databasus | |
|---|---|---|
| What it protects | One Postgres service | Postgres, MySQL, MariaDB and MongoDB, in one or several projects |
| Backup type | Continuous WAL plus weekly full and daily differential | Scheduled logical dumps with retention |
| Restore to a chosen second | Yes, inside the window | No, restore a whole backup |
| Where files go | A Railway Bucket created by the template | A Railway Bucket, or the local volume |
| Alerts | Failed cron runs in PITR Monitor | Slack, Telegram, Discord, Teams, Mattermost or webhooks |
| Estimated cost | About $2 idle, about $17 for the 5 GB example | About $2 to $3 idle, about $6 to $7 typical |
Deploy Postgres with PITR, step by step
These steps use Tracklayer’s PostgreSQL 18 with Point-in-Time Recovery template.
- Deploy the template. It creates Postgres 18 (Railway’s
postgres-ssl:18image with pgBackRest), PgBouncer, a PITR Monitor cron service, a Postgres Restore slot and a Bucket. The password is generated at deploy. - Connect your app. Use
DATABASE_POOL_URLfor application queries andDATABASE_URLfor migrations. From outside Railway useDATABASE_PUBLIC_URLwith?sslmode=require. The variable names match Railway’s own Postgres. - Wait for the first full backup. It starts minutes after the first deploy. After that a full runs weekly and a differential daily, and 4 fulls are kept.
- Check backup health. Open PITR Monitor and then Cron Runs. Each run logs
OK:orFAIL:lines and the restore window. A run that exits with an error is a failed run. - Rehearse a restore before you need one. Pick a UTC time inside the window, set
PITR_RESTORE_TARGET_TIMEon Postgres Restore (orlatest) and deploy. Check the data overrailway ssh, copy rows back or point an app at the slot, then wipe the slot’s volume to reset it.
The restore only writes into the slot’s own empty volume. It never touches the live database or the bucket. After losing the Postgres volume, use an explicit time from before the loss, not latest.
Deploy Databasus, step by step
These steps use Tracklayer’s Databasus v3 template, which runs Databasus 3.61.0.
- Deploy into the same project as your database and enter your email as
DATABASUS_ADMIN_EMAIL. A generatedDATABASUS_ADMIN_PASSWORDis set on the service and open sign-up is off. - Sign in. The page shows Sign up first; switch to Sign in.
- Add storage. Under Storages add S3 and copy the
S3_*values from the service variables, with virtual-hosted style ticked. - Add your database with its private
DATABASE_URL, and accept the offer to create a read-only user. Set the schedule, retention and alerts, and run a first backup. - Save the encryption key with
railway ssh --service Databasus -- cat /databasus-data/secret.key. Encrypted backups cannot be read without it if the volume is lost.
To restore, open a backup and choose Restore from this backup, then enter an empty target database. The restore replaces whatever the target holds.
What it costs
Railway bills usage, so cost follows memory, volumes, bucket storage and upload traffic. All figures here come from the templates’ own estimates; none are measurements. The PITR template estimates about $2 a month idle, and about $17 a month for a 5 GB database writing about 1 GB of WAL a day, which includes about 25 GB of bucket storage and about 35 GB of monthly uploads counted as egress. Fewer kept fulls or a longer POSTGRES_ARCHIVE_TIMEOUT lower it. Databasus is estimated at about 0.2 GB of RAM at idle, roughly $2 to $3 a month, and about $6 to $7 with daily backups of a few GB.
Limitations and licence notes
- Restore not verified end to end. The PITR template’s notes say the restore was tested against stubs and that the combination on Railway is unverified until a drill passes. Run one first.
- Bucket protection. Railway Buckets have no versioning or object lock, and the bucket keys can read and delete backups. Limit who can see variables, and keep an off-site copy if you need immutable backups.
- Single node. The PITR template has no read replicas. Give the restore slot a volume as large as the database.
- Databasus and PITR. It does not offer PITR for Railway Postgres. Per its README, Railway’s own Point-in-Time Recovery in the Backups tab is the route when you need to rewind a Railway Postgres to a specific second. Check Railway’s documentation for its current terms.
- Email alerts. Databasus email notifiers need SMTP, which Railway allows only on the Pro plan. Other notifiers work on every plan.
- Licences. Databasus is Apache-2.0. The PITR template uses PostgreSQL (PostgreSQL License), pgBackRest (MIT) and PgBouncer (ISC). Both are community templates, not affiliated with the upstream projects.
Other options
Many teams use both: Databasus for scheduled logical backups across databases, and WAL archiving for rewinding one critical database. For more Postgres variants, see the ranking of Postgres templates on Railway, or browse all guides.
FAQ
What is the difference between a daily dump and point-in-time recovery?
A daily dump can lose up to a day of data and cannot recreate the state just before a bad migration or an accidental DELETE. Point-in-time recovery keeps base backups plus the continuous write-ahead log, so the database can be replayed to a chosen moment inside the retention window.
How far back can the PITR template restore?
It keeps 4 full backups, which the template describes as about 3 to 4 weeks of recovery window, and archives each write-ahead log segment within about a minute of a change. The exact window is logged by each PITR Monitor run.
Has the restore been tested end to end?
Not according to the template's own notes. The restore slot and the monitor were tested against stubs, and the template says the combination on Railway is unverified until you run a restore drill. Run one on a non-critical database before relying on it.
Can Databasus do point-in-time recovery on Railway Postgres?
No. Databasus 3.61 supports point-in-time recovery only with physical PostgreSQL 17+ backups over the replication protocol, which Railway's managed Postgres does not accept from other services by default. The Databasus template therefore offers scheduled logical backups and restores.
What do these backup setups cost?
Both figures are estimates, not measurements. The PITR template author estimates about $2 a month idle and about $17 a month for a 5 GB database writing about 1 GB of WAL a day, including bucket storage and upload egress. Databasus is estimated at about $2 to $3 a month idle and about $6 to $7 with daily backups of a few GB.