---
title: "Deploying to Railway"
description: "Deploy your RivetKit app to Railway."
skill: true
---

## Steps

<Steps>
<Step title="Prerequisites">

- [Railway account](https://railway.app)
- Your RivetKit app
  - If you don't have one, see the [Quickstart](/docs/actors/quickstart) page or our [Examples](https://github.com/rivet-dev/rivet/tree/main/examples)
- Access to the [Rivet Cloud](https://dashboard.rivet.dev/) or a [self-hosted Rivet Engine](/docs/general/self-hosting)

</Step>
<Step title="Deploy to Railway">

1. Connect your GitHub account to Railway
2. Select your repository containing your RivetKit app
3. Railway will automatically detect and deploy your app

See [Railway's deployment docs](https://docs.railway.com/quick-start) for more details.

</Step>
<Step title="Set Environment Variables">

After creating your project on the Rivet dashboard, select Railway as your provider. You'll be provided `RIVET_ENDPOINT` and `RIVET_PUBLIC_ENDPOINT` environment variables to add to your Railway service.

See [Railway's environment variables docs](https://docs.railway.com/guides/variables#service-variables) for more details.

</Step>
<Step title="Connect to Rivet">

1. In your Railway project, go to **Settings > Networking**
2. Click **Create Custom Domain** then **Create Domain** to generate a Railway domain (e.g. `my-app.railway.app`)
3. On the Rivet dashboard, paste your domain with the `/api/rivet` path into the connect form (e.g. `https://my-app.railway.app/api/rivet`)
4. Click "Done"

<Warning>
Rivet envoys connect to your app over long-lived WebSockets, and your app's clients (browsers, SDKs) do the same. Railway's HTTP proxy supports WebSockets, but if you front your app with your own reverse proxy (NGINX, Caddy, etc.) inside the Railway service, raise its idle / read timeout to at least 1 hour (`3600` seconds). Default proxy timeouts (typically 30 to 60 seconds) drop these connections and cause reconnect storms.
</Warning>

</Step>
<Step title="Configure Sleeping & Multi-Region (Optional)">

- [Enable App Sleeping](https://docs.railway.com/reference/app-sleeping) to reduce costs when idle
- [Configure Multi-Region](https://docs.railway.com/reference/deployment-regions) to deploy closer to your users

</Step>

</Steps>
