Watch: Host my backend server and database on Railway | Vovy

Watch Vovy do it on a Mac: "Put my Express backend on Railway with a Postgres database". 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"

Deploy a Node or Express backend from GitHub to Railway, add a Postgres database, wire the connection string, and get a public URL.

What happens in the video

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
Read the step-by-step guide