Skip to content
37 changes: 36 additions & 1 deletion src/content/docs/en/guides/deploy/railway.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,47 @@ i18nReady: true
stub: true
---

import { Steps } from '@astrojs/starlight/components';

[Railway](https://railway.com) is a deployment platform built to simplify your infrastructure stack from servers to observability with a single, scalable platform.

This guide is for deploying an Astro static site to Railway using either the web interface or Railway CLI tool.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we say that Railway can also deploy on-demand rendered sites, can we have a sentence here like:

To deploy an on-demand rendered site with a server adapter to Railway...

and then whatever brief guidance we'd give? "... see the Railway SSR deploy guide."

This would just make it seem less strange to come from the main page that has both badges, but see no mention of server rendered apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes complete sense to me. I'll get this updated.


## Project Configuration

Railway's default build system, [Railpack](https://docs.railway.com/reference/railpack), automatically builds your Astro project as a static site.

## Deploy via the web interface

<Steps>
1. Create a [Railway account](https://railway.com/dashboard) and sign in.

2. From the Railway dashboard, create a new [project](https://docs.railway.com/guides/projects).

3. Select the option to deploy from a GitHub repository, and select your Astro project.

4. Generate or add a custom domain from your project's [network settings](https://docs.railway.com/guides/public-networking#railway-provided-domain).
</Steps>

## Deploy via Railway CLI

<Steps>
1. [Install](https://docs.railway.com/guides/cli#installing-the-cli) the Railway CLI tool.

2. Login with the command `railway login`.

3. From within your Astro project, run `railway init` and choose a workspace and project name.

4. Run `railway up` to deploy your project on Railway.

5. Run `railway domain` to generate a Railway provided service domain.
</Steps>


## Official Resources

[Railway guide to deploying an Astro app](https://docs.railway.com/guides/astro)

## Community Resources

[How to host an Astro site on Railway](https://jacksmith.xyz/blog/how-to-host-astro-site-on-railway)
[How to host an Astro site on Railway](https://jacksmith.xyz/blog/how-to-host-astro-site-on-railway)