"How much will Railway cost me?"
Nobody can answer that for you, including Railway, because the answer is a
function of your memory, CPU, egress and volume usage. What you can do is
multiply. examples/project_cost.py does the multiplication from numbers you
read off your own metrics panel.
"Isn't there a free tier?" There is a one-time trial credit for new accounts and a small recurring monthly credit on the free plan. Neither is a free tier in the sense people mean when they search for one — they are an amount of money, and a database that runs continuously spends money continuously. The trial ends by arithmetic rather than by a date, which is why people are surprised by it.
"So should I move my database off Railway?" Probably not, if you deploy your application there. There is a whole section on that below, and it is not a formality.
"What's actually in this repo?" A cost projector, an export script for all four database types Railway commonly hosts, and an argument about when moving is and is not worth it. The worked destination is a free Postgres instance; the export half is destination-agnostic.
git clone https://github.com/freebase-cloud/railway-database-alternative
cd railway-database-alternative/examples
python3 project_cost.py --plan hobbyservice memory cpu egress volume total
------------------------------------------------------------
web 10.00 10.00 4.00 0.00 24.00
worker 3.50 8.00 0.10 0.00 11.60
postgres 7.50 4.00 0.25 1.50 13.25
redis 2.00 1.00 0.05 0.15 3.20
------------------------------------------------------------
usage 52.05
share of usage cost by resource:
memory 44.2% ###########
cpu 44.2% ###########
egress 8.5% ##
volume 3.2% #
Those figures come from examples/usage-example.json — a made-up four-service
project — multiplied by examples/rates.json. Replace both with your own and
the output describes your bill instead of a fictional one.
Three things it does that a spreadsheet does not:
--growth Nre-runs the projection at N times the traffic, scaling memory, CPU and egress but not volume. "What if this works" is the question that decides architecture, and it is easier to answer before you commit.--compare-planslays every plan inrates.jsonside by side, including the subscription and the included usage, so you can see where the crossover is rather than guessing.- It refuses to run on stale rates.
rates.jsoncarries averified_ondate. More than 90 days old and the script stops and points you at the source URL. A cost model nobody has checked since spring is worse than no model, because you will believe it.
Full flag list and a table of where to find honest usage numbers:
examples/README.md. The short version — take the
average from the metrics panel, not the peak, because usage billing follows
usage.
| Trial | Free | Hobby | Pro | |
|---|---|---|---|---|
| Subscription | none | none | monthly | monthly |
| Included resource usage | one-time grant | small monthly credit | equal to the subscription | equal to the subscription |
| Recurring? | no | yes | yes | yes |
| Overage | billed | billed | billed | billed |
Metered resources: memory, vCPU, network egress, volume storage.
Last verified: 2026-08-18 against Railway's pricing plans
documentation. The exact rates are in
examples/rates.json with the same date on them. Check both before deciding
anything — plan structures move, and a table on GitHub is not a contract.
The structural point that survives any repricing: a database is the worst possible workload for a spend-down credit. It runs 730 hours a month whether or not anyone uses your app. A web service can idle down; a Postgres container holding a volume cannot. If your credit is disappearing and you cannot see where, run the projector — it is almost always the always-on services, and the share-by-resource bars usually point at memory rather than the egress people expect.
If this section were short, the rest of the page would not be worth reading.
Developer experience. Connect a repository, get a deployment. No build configuration to write, no YAML to learn before the first success. Very few platforms make the first ten minutes that easy, and the ones that do generally make minute sixty harder.
Templates. One click deploys a Postgres, a Redis, a MinIO, a full application stack with the services wired to each other and the connection strings injected as variables. For prototyping this is a real time saving, not a demo trick.
Service variable references. ${{Postgres.DATABASE_URL}} in another
service's environment resolves to the right value, and keeps resolving when the
database is replaced. Once you have used it, hardcoding a connection string in
a dashboard somewhere else feels like a downgrade.
Private networking. Services in a project talk to each other over an internal network. Your database is not on the public internet unless you ask for it, and internal traffic is not egress.
Honest metering. You pay for what you use rather than for a tier you half-fill. That is fairer than the alternative, and it is the reason the number is hard to predict — those two properties are the same property.
- Your application is deployed there. Moving the database out puts the public internet between your app and its data, costs you the private network hop, adds latency to every query, and leaves you operating two providers. The variable references stop working. This is usually a bad trade and it is the most common mistake this repository is trying to prevent.
- You use templates or one-click stacks. The convenience is the product. Unpicking one service from it is more work than it looks.
- Your projection is small and stable. Run
project_cost.py. If the number is a few dollars a month and flat, a migration costs you more in an afternoon than it saves in a year. - You need the database to be private. Anything you move off-platform has to be reachable from Railway, which means a public endpoint and a credential on the internet. That is a security change, not just a hosting change.
- You are on Pro with a team. Environments, PR deploys and shared access are things you would have to rebuild, and this repository has nothing to say about them.
Move if the database is a scratch instance for local development that does not need to live on a deployment platform at all; if you are running a hobby project that will never justify a subscription; if you want a database that outlives whichever platform hosts the app this quarter; or if the projector tells you the always-on database is most of your bill and the workload is genuinely tiny.
railway link
railway variables # find DATABASE_PUBLIC_URL
export DATABASE_URL='postgres://...'
./examples/export-database.shOne script, four engines, detected from the URL scheme: pg_dump -Fc for
Postgres, mysqldump --single-transaction for MySQL and MariaDB, mongodump --gzip for MongoDB, redis-cli --rdb for Redis where the server allows it.
Each finishes by printing the matching restore command.
Two details worth knowing before you start. Use the public URL —
*.railway.internal hostnames resolve only inside the project's network, and
the failure looks like a credentials problem. And the MySQL path passes the
password via MYSQL_PWD rather than an argument, because command lines are
visible to every process on the machine.
The script never writes to Railway. It reads, and it writes local files.
Reversibility comes from sequencing, not from tooling: keep the Railway service running and paid while the new destination handles real traffic for a few days. If it goes wrong, change the connection string back and redeploy. Deleting the Railway project is the one step you cannot take back, and there is no reason to take it the same week you migrate.
If you need to reverse after live traffic has landed on the new host, dump that host and restore into Railway. Same tools, opposite direction.
freebase.cloud gives you a free instance with no credit card and no spend-down meter attached. Three of its engines speak their native wire protocol, which is what the restore commands above need:
| Engine | Version | Connect |
|---|---|---|
| PostgreSQL | 16.2 | psql -h HOST -p 5432 -U freebase -d mydb |
| MySQL | 8.0.36 | mysql -h HOST -P 3306 -u freebase mydb |
| MongoDB | 7.0.4 | mongosh "mongodb://HOST:27017/mydb" |
| Redis | 7.2.3 | redis-cli -h HOST -p 6379 |
Last verified: 2026-08-18.
# a Railway Postgres export, restored
pg_restore --dbname="$TARGET_DSN" --no-owner --no-privileges --jobs=4 \
./exports/railway-postgres-20260818-104500.dumpStated plainly so the comparison is fair: this is a free tier aimed at development, prototyping and small production workloads. There is no published SLA, no uptime figure and no documented backup schedule. Railway is a platform you can run a business on; that is not the claim being made here. What is being claimed is that a free instance without a credit meter is a better home for a development database than a credit balance you have to watch.
The same instance is addressable by AI assistants over the Model Context
Protocol. Settings → MCP → New Token, choose the connection, copy the URL. A
connection named main exposes main_query, main_store, main_list_tables
and main_annotate_table.
claude mcp add --transport http main https://freebase.cloud/api/mcp/YOUR_TOKENCursor (.cursor/mcp.json):
{ "mcpServers": { "main": { "url": "https://freebase.cloud/api/mcp/YOUR_TOKEN" } } }Gemini CLI, where the key name catches people out — httpUrl means streamable
HTTP, and plain url means SSE:
{ "mcpServers": { "main": { "httpUrl": "https://freebase.cloud/api/mcp/YOUR_TOKEN", "timeout": 5000 } } }Claude Desktop takes the URL through Settings → Connectors → Add custom connector rather than a config file, which the connection walkthrough covers screen by screen. Because the token is a path segment, no client needs to send an auth header — and equally, anyone holding the URL can write to the database.
- Idle is not free. A container holding a volume bills for memory around the clock. Four small always-on services cost more than one medium one.
- The average is what you pay, the peak is what you remember. Sizing your projection off the peak overestimates, sometimes by a lot.
- Egress is usually not the problem. Run the projector and look at the share bars before optimising the thing you assume is expensive.
- Replicas multiply almost everything. Memory, CPU and egress scale with replica count; volume storage does not.
- A staging environment is a second bill. Environments are convenient and they are not free.
- Free tiers change. That is the entire reason this repository exists, and it applies to every provider named on this page, including the one in the org name. Keep exports. Test a restore.
- Railway pricing plans — plans, credits, metered resources
- Railway CLI —
railway link,railway variables,railway run - PostgreSQL 16: pg_dump · mongodump
- Free PostgreSQL cloud instance · free MySQL · free MongoDB
- How to connect Claude to PostgreSQL
freebase.cloud is an independent service and is not affiliated with Railway Corp., MongoDB, Inc., Oracle Corporation, or the PostgreSQL Global Development Group.