Deploy a Node or Express backend from GitHub to Railway, add a Postgres database, wire the connection string, and get a public URL.
Put my Express backend on Railway with a Postgres database
How it works
- Create a Railway project from GitHub: Vovy opens railway.com, clicks New Project, then Deploy from GitHub repo, and picks your backend repo. You sign in with GitHub yourself.
- Add a Postgres database: Vovy adds a PostgreSQL service to the same project. Railway creates it and gives it a DATABASE_URL, the address your code uses to reach it.
- Link the database to your app: Vovy opens your app service's Variables tab and adds a reference to the database's DATABASE_URL, plus the other keys from your .env.
- Check the start command and port: Your server must listen on the PORT Railway provides. Vovy checks your code for a hardcoded port like 3000 and fixes it if needed.
- Generate a public domain: Vovy asks, then clicks Generate Domain under Networking, calls your health route, and shows a card with the live API URL and monthly cost estimate.
What you provide
- Your backend code on GitHub
- A Railway account
- A card for the Hobby plan
What you get
- A live API URL
- A managed Postgres database
- Env vars wired correctly
- Cost estimate card
FAQ
What does Railway cost?
Railway gives new accounts a one-time trial credit. After that the Hobby plan is $5 a month, which includes $5 of usage, and you pay for anything above it.
Why use Railway instead of Vercel?
Vercel is built for websites and short-lived functions. Railway runs servers that stay on, like websocket apps, workers and bots.
My deploy says Application failed to respond. What's wrong?
Almost always the server listens on the wrong port. It must use process.env.PORT, which Vovy checks in step four.
Related tasks
All tasks