How to Host Custom Shopify Apps on Railway: A Step-by-Step Guide

November 6, 2025 5 min read
Back to Blog

Hosting a custom Shopify app can often feel more complicated than building one. While the documentation for coding apps is robust, clear tutorials on deploying them to hosting services like Railway are often lacking.

In this guide, we will walk through the exact process of taking a local Shopify app (built with Remix and JavaScript) and hosting it properly on Railway. We won't be focusing on coding the app logic itself, but rather on the infrastructure and configuration required to get your app live.

Prerequisites

Before we begin, ensure you have the following set up:

  • Shopify CLI: You need the latest version installed. You can check this by running shopify version in your terminal.
  • Shopify Partner Account: Required to create and manage apps.
  • GitHub Account: For version control.
  • Railway Account: For hosting the application.

Step 1: Initialize Your App

First, navigate to the directory where you want your project to live. We will initialize a standard Remix app using the Shopify CLI.

Run the following command:

shopify app init

Follow the prompts:

  1. Template: Select Remix App (JavaScript).
  2. Organization: Select your Partner account organization.
  3. Project Name: Name your app (e.g., my-custom-app).

Once the installation is complete, navigate into your new directory.

Step 2: Verify Local Development

Before hosting, it is good practice to ensure the app works locally.

npm run shopify app dev

This command will ask you to log in to your Partner account. If you don't have a development store, the CLI will prompt you to create one. Once the server is running, press P to preview the app in your browser. Verify that the test data generation (like creating products) works as expected.

Step 3: Set Up Version Control

Railway deploys directly from GitHub, so we need to push our code to a repository.

  1. Initialize Git:
    git init
    git add .
    git commit -m "Initial commit"
    
  2. Create a Repository: Go to GitHub, create a new repository, and copy the remote URL.
  3. Push Code:
    git remote add origin <your-repo-url>
    git branch -M main
    git push -u origin main
    

Step 4: Create a Project in Railway

  1. Log in to your Railway Dashboard.
  2. Click New Project -> Deploy from GitHub repo.
  3. Select the repository you just created.
  4. Click Deploy Now.

Note: The initial build might succeed, but the deployment will likely fail or throw errors because we haven't set the environment variables yet. This is expected.

Step 5: Configure Environment Variables

To run successfully, Railway needs specific credentials from Shopify.

1. Retrieve Variables

In your local terminal, run:

shopify app env show

This will output your SHOPIFY_API_KEY, SHOPIFY_API_SECRET, and SCOPES.

2. Add to Railway

Go to your Railway project, navigate to the Variables tab, and add the following:

  • SHOPIFY_API_KEY: Paste the value from your terminal.
  • SHOPIFY_API_SECRET: Paste the value from your terminal.
  • SCOPES: Usually write_products (or whatever scopes your app requires).

Step 6: Configure Domain and App URLs

Your app needs a public domain to communicate with Shopify.

  1. Generate Domain: In Railway, go to Settings -> Networking and click Generate Domain. Copy this URL (e.g., production-app.up.railway.app).
  2. Set App URL Variable: Go back to the Variables tab in Railway and add a new variable:
    • SHOPIFY_APP_URL: Paste your generated Railway domain (ensure you include https://).

Step 7: Update shopify.app.toml

This is the most critical step. You must tell Shopify where your hosted app lives. Open your local shopify.app.toml file.

Update the application_url and redirect_urls to match your Railway domain:

# shopify.app.toml

application_url = "https://your-railway-domain.up.railway.app"
redirect_urls = [
  "https://your-railway-domain.up.railway.app/auth/callback",
  "https://your-railway-domain.up.railway.app/auth/shopify/callback",
  "https://your-railway-domain.up.railway.app/api/auth/callback"
]

Step 8: Deploy Configurations

Now we need to sync these configuration changes with Shopify and push the code changes to Railway.

  1. Update Shopify Config:

    shopify app deploy
    

    Confirm that you want to release this new version. This updates the URLs in your Partner Dashboard.

  2. Push to GitHub:

    git add .
    git commit -m "Update application URLs"
    git push
    

Railway will detect the new commit and automatically trigger a redeploy.

Step 9: Configure App Distribution

While Railway deploys, configure how the app is distributed:

  1. Go to your Shopify Partner Dashboard -> Apps -> Your App.
  2. Click App Distribution.
  3. Select Custom Distribution (since this is an internal or custom app).
  4. Click Choose Custom Distribution and confirm.

Step 10: Final Test

Once Railway finishes the deployment:

  1. In the App Distribution section of your Partner Dashboard, generate a generic install link or select a development store.
  2. Install the app on your store.
  3. Check the URL bar in the browser. You should see your Railway domain (...up.railway.app) being used instead of localhost.

If the app loads and allows you to generate products (or perform its intended function), you have successfully hosted your custom Shopify app on Railway!


Summary

Hosting on Railway offers a scalable and straightforward solution for Shopify apps, but ensuring the shopify.app.toml configuration matches your hosting environment is key. By following these steps, you ensure your app is secure, properly routed, and ready for production usage.

Will Misback

About Will Misback

I build the systems that turn traffic into profit. As a Shopify development consultant, I eliminate bottlenecks and engineer systems tied to your bottom line: reducing costs, raising LTV, and maximizing AOV. I combine full-stack development, conversion rate optimization, and strategic analytics to deliver results that pay for themselves.

Ready to Grow Your Business?

Let's discuss how we can help grow your e-commerce business.

Get in Touch