Railway
Last checked with Wasp 0.26 and Railway (as of Apr 6, 2026).
This guide depends on external libraries or services, so it may become outdated over time. We do our best to keep it up to date, but make sure to check their documentation for any changes.Automatic Deployment server client database
We recommend that you use Wasp Deploy to deploy your Wasp app to Railway. Wasp CLI automates deploying your app and its database with one command.
Manual Deployment server client database
This guide shows you how to deploy your app and provision a database on Railway.
A built Wasp app is a single server that serves your app's pages, its static assets and its API, so it needs a single Railway service.
Prerequisites
To get started, follow these steps:
- Make sure your Wasp app is built by running
wasp buildin the project dir. - Create a Railway account.
- Install the Railway CLI.
- Run
railway loginand a browser tab will open to authenticate you.
Create New Project
Let's create our Railway project:
- Go to your Railway dashboard, click on New Project, and select Deploy PostgreSQL from the dropdown menu.
- Once the project is created, left-click on the Create button in the top right corner and select Empty Service.
- Click on the new service, and change the name to
app. - Deploy the changes by pressing the Deploy button on top.
Deploy Your App to Railway
Setup the Domain
We'll need the domain for the app service:
- Go to the
appinstance's Settings tab, and click Generate Domain. - Enter
8080as the port and click Generate Domain. - Copy the domain, as we will need it later.
Deploying the App
-
Move into the
.wasp/outdirectory:cd .wasp/out -
Link the
.wasp/outdirectory to your newly created Railway project:railway linkSelect
appwhen prompted to select a service. -
Go into the Railway dashboard and set up the required env variables:
Click on the
appservice and go to the Variables tab:-
Click Variable reference and select
DATABASE_URL(it will populate it with the correct value) -
Add
PORTwith the value8080, the port you generated the domain for. -
Add
WASP_SERVER_URLwith theappdomain (e.g.https://app-production-XXXX.up.railway.app).https://prefix is required! There's no separate client URL to configure:WASP_WEB_CLIENT_URLdefaults toWASP_SERVER_URL, and one server serves both your app's pages and its API. -
Add
JWT_SECRETwith a random string at least 32 characters long
-
-
Push and deploy the project:
railway up --ciWe use the
--ciflag to limit the log output to only the build process.Railway will locate the
Dockerfilein.wasp/outand build one image with your whole app in it: its pages, its static assets and its API.
And now your Wasp app should be deployed!
Back in your Railway dashboard, click on your project and you should see your newly deployed services: PostgreSQL and the app.
Updates & Redeploying
When you make updates and need to redeploy:
-
Run
wasp buildto rebuild your app. -
Go into the
.wasp/outdirectory and deploy it with:railway up --ci