Skip to content

Deploy on Railway ​

Let's deploy your app on Railway πŸš€

You have two options to deploy your app on Railway...

One-click deploy mellow-vue ​

Simply click the button, and Railway will set up everything you need to get your new app live using the mellow-vue Railway template.

Deploy Mellow Vue on Railway

This template includes:

  • Mellow Vue: The Boring Stack Mellow template with Vue.js.
  • PostgreSQL: A pre-configured PostgreSQL database.
  • Redis: A pre-configured Redis instance.

One-click deploy mellow-react ​

Simply click the button, and Railway will set up everything you need to get your new app live using the mellow-react Railway template.

Deploy Mellow React on Railway

This template includes:

  • Mellow React: The Boring Stack Mellow template with React.js.
  • PostgreSQL: A pre-configured PostgreSQL database.
  • Redis: A pre-configured Redis instance.

One-click deploy mellow-svelte ​

Simply click the button, and Railway will set up everything you need to get your new app live using the mellow-svelte Railway template.

Deploy Mellow Svelte on Railway

This template includes:

  • Mellow Svelte: The Boring Stack Mellow template with Svelte.js.
  • PostgreSQL: A pre-configured PostgreSQL database.
  • Redis: A pre-configured Redis instance.

GitHub Repo ​

Push your app to a repo on GitHub.

Create database ​

Create the database you want to use for production on Railway and take note of the connection url.

Database creation guides

See guides for MySQL, PostgreSQL, and, MongoDB on the Railway docs.

Create Redis instance ​

Create the production Redis instance and take note of the connection url.

Redis instance guide

See the guide to create a Redis instance on the Railway docs.

Set up database ​

Depending on the database you want to use for production, set up that adapter in config/environment/production.js

js
module.exports = {
  datastores: {
    default: {
      adapter: 'sails-postgresql',
      url: process.env.DATABASE_URL
    }
  }
}
js
module.exports = {
  datastores: {
    default: {
      adapter: 'sails-mysql',
      url: process.env.DATABASE_URL
    }
  }
}
js
module.exports = {
  datastores: {
    default: {
      adapter: 'sails-mongo',
      url: process.env.DATABASE_URL
    }
  }
}

WARNING

Don't forget to install the adapter if you haven't already. See the database docs for more info.

Set up Redis ​

INFO

Create a new Redis instance on Railway by following the Railway docs.

Set up the Redis adapter in config/environment/production.js

js
module.exports = {
  session: {
    secret: process.env.REDIS_SECRET
    adapter: '@sailshq/connect-redis',
    url: process.env.REDIS_URL
  }
}

Create a web service ​

Create a new Web Service on Railway, and give Railway permission to access the repo of your app.

If necessary, use the following values during creation:

  • Runtime: Node
  • Build command: npm i
  • Start command: npm start

However, Railway is capable of configuring things automatically for you.

Set environment variables ​

Add the following evironment variables to your web service:

  • DATABASE_URL: This should point to the connection string of the database you created.
  • REDIS_URL: This should point to the connection string to the Redis instance you created.
  • SESSION_SECRET: A unique production session secret to override the one in config/session.js.

That’s it! Your app will be live on your Railway URL as soon as the build finishes πŸŽ‰

Celebrate with a ⭐ ​

Star The Boring JavaScript Stack repo on GitHub ⭐

Let's celebrate deploying your app on Railway by giving The Boring JavaScript Stack a star on GitHub.

All open source projects are released under the MIT License.