# From Code to Live: How I Launched My NodeJs App in Minutes with Railway.app

## Backstory (feel free to skip) -

As someone who’s totally clueless when it comes to infra-admin tech stuff, setting up environments for my personal projects has always been a total mess. I mean, I’ve tried dabbling with Google Cloud and AWS (shoutout to EC2 and Elastic Beanstalk), but the whole time I was just sitting there like, “Did I configure this right?” and “Is some sneaky service running that’s gonna leave me with a bill bigger than my rent?” Most days, I was neck-deep in docs, tutorials, and spamming ChatGPT with desperate questions. Then one day, like a happy accident in a cooking show, I stumbled upon this gem: [Railway.app](http://Railway.app).

## **What You’ll Need:**

• **A static site project**: React, Angular, Vue, or even good ol’ bare-bones HTML/CSS/JS—anything that gets the job done will work.

• **A Node.js project**: Just a boilerplate will do; we’re here to experiment, not reinvent the wheel.

**Pro Tip:** [Railway.app](http://Railway.app) hooks you up with a free $5 trial plan that renews every month (bless them!). If you’re feeling fancy and want to scale up, the Hobby Plan is just $5/month—cheaper than your daily coffee habit. 💸

## **Deploying Your Static Site (Made Easy!)**

**\[IMPORTANT PRE-REQ ALERT\]**  
Before we dive in, let’s get a couple of things straight. You’ve got a folder with your static site files—HTML, CSS, and maybe a sprinkle of JavaScript. Cool! But we’ll need something to actually serve those files. The easy way? Say hello to the serve npm package. It spins up a Node.js server in no time, and you don’t even have to write a single line of code. Lazy? Efficient? Both? Yes. 😎

Here’s what you do:

### 1\. **Initialize your project**

In your project root, run:

```bash
npm init
```

(If you haven’t already) and just follow the prompts. It’s a quick Q&A session.

### 2\. **Install** serve

```bash
npm i -s serve
```

Boom. It’s installed. 🎉

### 3\. **Update** package.json

Add this to your scripts section:

```json
"scripts": {
    "start": "serve -s dist -l 8080"
}
```

(Replace dist with the folder containing your static files, if it’s different.)

### 4\. **Test it out**

Fire up the server by running:

```json
npm run start
```

It’ll launch a Node.js server on port 8080. Don’t worry, we’ll need this later.

### 5\. **Push your changes**

Push your shiny updated package.json to your repository. 🛠️✨

### Now, head over to [**Railway.app**](http://Railway.app), log in, and let’s get this baby live! 🚀

![Continue with github](https://cdn.hashnode.com/res/hashnode/image/upload/v1736014371918/1b9a57cc-6394-457b-bf63-6b0388ea29e4.png align="center")

**Keep Going with GitHub 🚀**

1\. **Hit “Continue with GitHub”**  
Log in like a pro and connect your GitHub account.

2\. **Create a New Project**  
Click that shiny + New button and set up an empty project. Boom, you’re halfway there! 🎉

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1736014528566/65af4798-8be0-451c-96f2-60c1874f2809.png align="center")

**Add a Service 🚀**

1\. **Click “Add a Service”**  
Easy peasy.

2\. **Connect Your GitHub Account**  
Link it up and grant access to the repository you’re about to deploy. Don’t worry, it’s just Railway doing its magic! ✨

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1736014641720/7aed04e1-bb20-4836-9026-852d5ac63030.png align="center")

**Select Your Repository 🚀**  
Once you’ve picked your repository, Railway will greet you with its *everything-is-a-service* vibes. Think of it as your app’s personal butler, ready to serve! 🛠️✨

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1736014760379/ca47e6a2-91c2-404f-add1-ff3a61507e59.png align="center")

**Hit Deploy and Watch the Magic Happen! 🚀**  
Click that shiny **Deploy** button, sit back, and let Railway do its thing. In no time, your app will be live—like watching a movie, but faster and way cooler. 🎉✨

**Your App is Deployed! 🎉**  
Congrats, your app is live on Railway! 🚀 Now, we’re just one step away from making it public and sharing it with the world. Let’s wrap this up! 🌍✨

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1736014976508/c6701756-b552-48aa-b26b-04c0e8c5d3ae.png align="center")

### **Finishing Touches to Make Your App Public 🎉**

**Go to Your Service**

Click on your service (e.g., **Static Sample Project**), and you’ll land on its page. Head over to the **Settings** tab—this is where all the magic happens. 🛠️

### **Key Sections in Settings:**

**Source**

• **Connect the Branch**: Link your branch here, and every time you push a new commit, it’ll trigger an automatic deployment. Zero manual effort—just vibes. ✨

**Network**

• **Custom Domain**:

• Want to use your own domain? Connect it here.

• Update the DNS records with your domain registrar or whoever’s holding your nameservers hostage.

• **Generated Domain**: No custom domain? No worries—Railway can whip one up for you in seconds. 🌐

**Build & Deploy**

• **Custom Build Commands**: Got any special build commands? Add them here under the build section.

• **Deploy Command**: By default, this will use the npm run start command we set up with the serve package. If you customized it, just make sure it’s updated here.

**Deploying a Node.js Server 🚀**

It’s the *same drill* as above—skip the pre-requisite for static files, and you’re good to go.

# **And Voila! ✨**

That’s it—you’re live! 🎉 Your app is now ready for the world to see. Time to celebrate and share the link! 🚀🌍

<details data-node-type="hn-details-summary"><summary>Summary 🚀</summary><div data-type="detailsContent">We’ve gone from setting up a simple static site to deploying it live on <a target="_self" rel="noopener noreferrer nofollow" href="http://Railway.app" style="pointer-events: none"><strong>Railway.app</strong></a> in just a few steps. From connecting your GitHub repo, configuring deployment settings, and even managing custom domains, Railway simplifies the entire process. Whether it’s a static site or a Node.js app, the flow is intuitive, fast, and stress-free.</div></details><details data-node-type="hn-details-summary"><summary>End Note</summary><div data-type="detailsContent"><a target="_self" rel="noopener noreferrer nofollow" href="http://Railway.app" style="pointer-events: none">Railway.app</a> isn’t just a platform—it’s like having a DevOps buddy who handles the heavy lifting while you focus on building. Its developer experience (DX) is top-notch: seamless deployments, auto-configured services, and a clean interface that doesn’t make you dig for features. For anyone tired of wrestling with infra headaches, Railway is a refreshing, delightful tool to have in your arsenal. 🚀✨</div></details>
