Railway database alternative: what the meter costs for one app and its previews
Short version: a Railway database is a container on the same usage meter as your app. As of November 2026 that meter is $10 per GB of RAM per month, $20 per vCPU per month and $0.15 per GB of volume per month, drawn against the included credit on Hobby ($5) or Railway Pro ($20), which your app services share. One small, quiet Postgres fits inside that credit easily. The trouble starts when the database count grows: every preview environment that runs its own database is another container on the meter, Hobby volumes stop at 5 GB, and the bill depends on how busy everything was. If you want the database priced as a flat line instead, Layerbase is $5 for Solo and $15 for Pro, with branches included. If your app and database living in one project on one private network is the thing you value most, stay on Railway.
Contents
- What a Railway database actually is now
- The meter, as of November 2026
- Bill one: a small app with one always-on database
- Bill two: the same app with three preview databases
- Engines
- Sleeping and staying awake
- Branching and preview environments
- Operations: who does what
- When Railway is the better choice
- FAQ
- Moving only the database
What a Railway database actually is now
Earlier this year I wrote that Railway databases were unmanaged, because Railway's own reference docs said so. That has changed, and it is worth starting from the current picture rather than the old one.
Railway's database docs now say it maintains its PostgreSQL, MySQL, Redis and MongoDB templates, and list HA variants of all four plus a PgBouncer pooling template. The split of responsibility on that page is specific. Railway handles provisioning, storage, networking and security patches to the image. You turn on backups and point-in-time recovery, you turn on HA, you resize the volume, and you own major version upgrades (one click for Postgres).
The backups themselves are reasonable once you turn them on. Volume backups run daily (kept 6 days), weekly (kept 27 days) or monthly (kept 89 days), are incremental and copy-on-write, and bill at volume rates for the data exclusive to each backup. Point-in-time recovery covers Postgres, with roughly four weeks of restore window, and MySQL, with seven days, billed through storage and egress with no separate fee.
So the real comparison is no longer managed against unmanaged. It is a container you configure on a usage meter against a database on a flat plan.
The meter, as of November 2026
From railway.com/pricing and the plans reference, checked 2026-11-15:
| Plan | Monthly fee | Included usage | Max volume size |
|---|---|---|---|
| Free | $0 | $1/month | 0.5 GB |
| Hobby | $5 | $5/month | 5 GB |
| Pro | $20 per workspace | $20/month | 1 TB |
Usage on top of that is $10 per GB of RAM per month, $20 per vCPU per month, $0.15 per GB of volume per month, and $0.05 per GB of egress, metered per minute. There is also a 30-day trial with $5 of one-time credit and no card. The fee is a floor: if usage stays under the included amount you pay the fee, and above it you pay the difference.
Two details from that table decide more than the rates do. The included credit is for the whole workspace, so your app, your workers and your database all draw from the same $5 or $20. And a Hobby volume stops at 5 GB, so a database that outgrows that moves you to Railway Pro and its $20 floor regardless of how little CPU it uses.
Bill one: a small app with one always-on database
Railway bills what the container actually uses, so there is no single price for "a small Postgres". The arithmetic below uses stated assumptions, not a measurement. Plug in the numbers from your own metrics tab.
Assume the Postgres container averages 0.25 GB of RAM and 0.02 vCPU across the month, on a 2 GB volume, and the app beside it averages 0.5 GB and 0.05 vCPU:
| Line | Railway Hobby |
|---|---|
| Postgres RAM (0.25 GB x $10) | $2.50 |
| Postgres CPU (0.02 vCPU x $20) | $0.40 |
| Postgres volume (2 GB x $0.15) | $0.30 |
| App RAM and CPU | $6.00 |
| Usage total | $9.20 |
| Bill | $9.20 (the $5 fee covers the first $5) |
That is a fair price, and I do not think anyone should leave Railway over it. The database share is about $3.20, which is less than a Layerbase Solo plan.
The same database on Layerbase is Solo at $5/month: two databases, 10 GB, a 768 MB always-on pool, backups every 12 hours kept 7 days, and no meter on queries, connections or egress. Pin the production database always-on and it stays up; a second database on the plan sleeps after six idle hours. Your app stays on Railway, so its $6 of usage still lands on a Railway bill, which brings that bill back to the $5 Hobby fee plus $1.
Read that honestly: for one quiet database, moving saves nothing and adds a vendor. The flat price earns its keep in bill two.
Bill two: the same app with three preview databases
Now add PR environments, which Railway creates when a pull request opens and deletes when it merges or closes. If each preview runs its own database (which it should, if your pull requests run migrations), each one is another Postgres container on the meter.
Same assumptions, three previews open for the whole month:
| Line | Railway Hobby |
|---|---|
| Production Postgres | $3.20 |
| Three preview Postgres containers (3 x $3.20) | $9.60 |
| App, production only | $6.00 |
| Preview app containers | more again |
| Bill | $18.80 plus the preview apps |
Previews are rarely open all month, and Railway's serverless mode can stop idle services (more on that below), so treat this as an upper bound for the database lines. The point is the shape: the bill scales with how many environments exist and how long they stay open, and neither of those is a number you set in advance.
On Layerbase the previews are branches of the production database, not new databases. Solo includes 3 branches per database and Pro includes 10. A branch does not take one of your plan's database slots, gets its own connection string and credentials, and can be labeled preview so it sleeps aggressively when nobody is using it. The database line stays $5 or $15 whether you have one open pull request or ten.
Engines
Railway's maintained templates are PostgreSQL, MySQL, Redis and MongoDB, each with an HA variant. Beyond those, anything with a Docker image runs as a service, which is a real strength: if the database you want is obscure, Railway will run it today. You just get the container, not anyone's opinion about how to operate it.
Layerbase Cloud runs 19 engines, each configured per engine and per plan. That covers PostgreSQL, MySQL, MariaDB, Redis and Valkey, plus engines outside Railway's four maintained templates, such as ClickHouse, Qdrant, Meilisearch, DuckDB and QuestDB. MongoDB itself is not one of them for licensing reasons; the document story on Layerbase Cloud is FerretDB and standalone DocumentDB, both of which speak the MongoDB wire protocol. If a real MongoDB server is a hard requirement, Railway's template is the more direct answer.
Sleeping and staying awake
Railway has Serverless (it used to be called App Sleeping). A service is treated as inactive once it stops sending outbound packets for 5 minutes, so in practice it sleeps 5 to 10 minutes after its last outbound traffic, and it wakes when traffic from the internet arrives, with a cold boot on that first request. Two caveats from the same page matter for databases specifically: private-network traffic counts as activity, and an open database connection, such as a pooler, can keep a service from ever sleeping. The docs do not describe how a database behaves as a serverless service, so test it before you count on it.
On Layerbase, sleep is a database feature rather than a container one. Free databases hibernate after 15 idle minutes and wake on the next connection. Paid databases sleep after six idle hours unless you pin them always-on, and paid databases are never archived for inactivity. A preview branch can be labeled to sleep aggressively, which is the setting you want for something that exists to be thrown away.
Branching and preview environments
This is the biggest functional difference between the two.
Railway's environment docs describe PR environments, focused PR environments that deploy only the services a change touches, and isolated environments with sync. They do not describe a database branch: a copy of the parent's data, made from the parent, with its own credentials. Check what data your preview database starts with before you trust a migration test against it.
Layerbase branches a real database with its real data, on 17 engines, PostgreSQL and MySQL included. With instant branching turned on, a new branch shares storage with its parent instead of copying it. The GitHub App and the Vercel integration can create a branch when a git branch appears and clean it up when it goes, so each preview gets its own data rather than sharing one staging database. The mechanics are in the branching docs.
Operations: who does what
| Railway | Layerbase | |
|---|---|---|
| Image security patches | Railway | Layerbase |
| Backups | Opt in per volume; daily, weekly or monthly schedules | Every 12 hours on Solo and Pro, kept 7 and 30 days; a manual slot on Free |
| Point-in-time recovery | Opt in; Postgres about 4 weeks, MySQL 7 days | PostgreSQL and FerretDB on Pro and above, on a database pinned always-on |
| High availability | HA templates for all four engines | Not offered on the shared plans |
| Volume size | You resize it; 5 GB cap on Hobby | Included in the plan: 10 GB Solo, 25 GB Pro, more in $10/month pool blocks |
| Billing | Per-minute usage against a workspace credit | Flat per plan |
The HA row is the one to read twice. Railway offers HA templates and Layerbase does not advertise HA or an uptime SLA on its shared plans. If your production database needs automatic failover, that row decides it.
When Railway is the better choice
Your app and database live together. One project, one push, a private network between the services that costs nothing and needs no TLS setup. Splitting the database out adds a public hop and a second dashboard. For a single app with one database, that is a cost with no matching saving, as bill one showed.
You need HA now. Railway's Postgres HA, MySQL HA, Redis HA and MongoDB HA templates fail over automatically once you turn them on. Layerbase's shared plans do not.
You need a real MongoDB server, or an engine nobody manages. Railway runs the image; Layerbase runs FerretDB or DocumentDB for the MongoDB wire protocol and does not host MongoDB itself.
Your usage really is tiny. If the whole workspace sits under $5 of usage, Hobby costs $5 for everything, app included. A flat database plan cannot beat that.
The case for moving the database is narrower: you have several databases, previews multiply them, the volume is pushing past 5 GB on Hobby, or you want branching with real data rather than a fresh container per pull request.
FAQ
How much does a database cost on Railway?
As of November 2026 Railway bills $10 per GB of RAM per month, $20 per vCPU per month, $0.15 per GB of volume per month and $0.05 per GB of egress, metered per minute, against the included credit on Hobby ($5) or Railway Pro ($20), shared by every service in the workspace. A small, quiet Postgres can cost a few dollars of usage; the exact figure depends on what the container uses.
Are Railway databases managed now?
Partly. Railway's database docs say it maintains its PostgreSQL, MySQL, Redis and MongoDB templates and applies image security patches. Backups, point-in-time recovery, HA and volume resizing are features you turn on, and major version upgrades are yours.
Does Railway have database branching?
Railway has PR environments that are created when a pull request opens and deleted when it closes. Its environment docs do not describe branching a database's data. Layerbase branches a real database with its data on 17 engines, with 3 branches per database on Solo and 10 on Pro.
Can a Railway database sleep?
Railway's Serverless mode stops a service 5 to 10 minutes after its last outbound traffic and wakes it on incoming internet traffic. Open connections, a pooler included, keep a service awake, and the docs do not describe database-specific behavior. Layerbase paid databases sleep after six idle hours unless pinned always-on.
What is the Hobby volume limit on Railway?
5 GB. Free and the trial are 0.5 GB, and Pro goes to 1 TB. A database bigger than 5 GB needs Railway Pro, which starts at $20.
Can I keep my app on Railway and move only the database?
Yes, and it is the shape most people want. Set the new DATABASE_URL in the Railway service's variables and the deploy pipeline carries on. You give up the private-network hop between app and database.
Moving only the database
layerbase.com/migrate/railway reads a Railway Postgres, MySQL or Redis service once from a single Railway token and copies it into a matching database, with nothing written back. You need the TCP proxy on for the copy, and you should turn it off again afterward. The step-by-step version, including the manual pg_dump path, is in migrating a Railway database to Layerbase.
If you would rather test first, create a database on the free tier, point one preview environment at a branch of it, and see whether the next pull request that runs a migration behaves better than the last one.
Keep reading
- pgEdge Starfleet vs Layerbase: which fits a small SaaS team?Comparing pgEdge Starfleet with Layerbase for startups and small businesses: entry prices, database branching, Postgres plus a cache, and when enterprise deployment options matter.
- Preview environment platforms in 2026: what is in the database when the preview comes upEvery platform on this list will give a pull request its own URL. The question that sorts them is what is in the database behind that URL: nothing, a restore of last night's backup, or the live data as of right now. Here is where each of eleven platforms lands, quoted from their own docs, and what a preview costs while the PR sits open.
- Northflank alternatives: a preview environment is not a database branchNorthflank gives every pull request its own stack, and the database in that stack starts empty unless you seed it or restore it from a backup you already had. Here is exactly how their forks work, what a copy-on-write branch does differently, what each one costs while a PR sits open, and the cases where Northflank is the right answer.
- Redis Cloud alternatives: pay for the modules, or stop paying for themRedis Cloud prices itself around the module story: search, JSON, time series, vector sets, Active-Active. If you use those, the bill is buying something real. If you use Redis as a cache, a session store, or a queue, you are paying the module premium for a key-value store. Here is what each tier buys, where a flat plan fits, and when to stay.