HOSTING / LESSON 05
Your First Railway Deployment.
Deploying your first application

Loading the lesson…
Loading activities…
HOSTING / LESSON 05
Deploying your first application

Loading the lesson…
Loading activities…
This is where it all comes together. You're about to take code sitting on GitHub and put it live on the internet. Give it a few minutes and you'll have a working app that literally anyone in the world can visit.
Before we start, make sure you've got these.
Let's walk through it one step at a time.
From your Railway dashboard, click the "New Project" button. You'll see a few options for how to create it.
Click "Deploy from GitHub repo." That tells Railway you want to deploy code that already lives on GitHub.
Railway will show a list of your GitHub repositories. Find the one you want and click it.
Can't find your repository? Do this.
Railway might show you some configuration options. For most projects you can skip this and keep the defaults, because Railway is pretty smart about detecting what your project needs.
If your project needs specific settings, you can add them later.
Click the "Deploy" button. Railway gets to work right away.
After you click deploy, Railway runs through a handful of steps, and you can watch them happen in real time.
Railway downloads your code from GitHub. Usually that's just a few seconds.
Railway looks at your files to figure out what kind of app you've got. It can detect these and more.
Railway runs commands like npm install to grab all the packages your app needs. This might take a minute or two.
For apps that need compiling (like Next.js), Railway builds the production version. You'll see build logs scrolling by.
Finally, Railway starts your app and opens it up to the world.
Once the deploy finishes, you need a way to actually visit your app. Railway hands you a URL for that.
In your project, click the service that just deployed. It's usually named after your repository.
Look for a "Settings" tab or section inside your service.
Find the "Domains" section. Click "Generate Domain" to get a Railway URL.
Your URL will look something like your-app-name.up.railway.app.
Click the URL or paste it into your browser. Your app is live!
Here's where Railway gets really good. Every time you push code to GitHub, Railway deploys the new version automatically.
Let's try it out.
Open your project on your computer and change something simple, like the text on your homepage.
Save your changes, commit them with Git, and push to GitHub.
Hop back to your Railway dashboard. Within seconds you'll see a new deployment kick off on its own.
When the deployment finishes, refresh your app's URL. Your changes are live!
This automatic deploying is called "continuous deployment," or CD. It means your live app always matches your latest code on GitHub, without you lifting a finger.
Now that you've got a deployed project, let's look around the dashboard.
This shows your deployed app, including these.
Click here to see every deployment you've ever made. Each one shows you this.
Where you'll set environment variables (we'll cover these later).
Configure your service's options, domains, and more.
Sometimes deployments fail. It happens to everybody, so don't panic. Here's how to troubleshoot.
The logs tell you exactly what went wrong. Common culprits look like this.
package.jsonRailway highlights errors in red. The message usually tells you what to fix.
Railway needs to know how to start your app. For Node.js apps, make sure your package.json has a start script.
Copy the error message and search for it. Odds are somebody else hit the exact same problem and posted the fix.
Deployed something broken? You can go back to an earlier version.
In your service, click the "Deployments" tab.
Scroll through your deployment history for one that worked.
Click the three dots at the end of that deployment and pick "Rollback." Railway brings back that version, code and variables both... and you get to breathe again. (Really old deployments can age out of your plan's history, so you can't roll back forever.)
Your app is live! But most apps need somewhere to keep their data, so next lesson you'll add a database to your Railway project.