Building web applications with Swift using Vapor is super simple. Thankfully, deploying them is also a breeze. In just a few steps we’ll go from localhost to Heroku with Vapor’s CLI.

Prerequisites

We need a few things before we get started:

A working Vapor web application. If you don’t have one, you can follow this tutorial to get started. Git A free Heroku account Heroku Command Line Interface – Make sure to run heroku login once the CLI is installed to authenticate your account.

Deploying to Heroku

Vapor supports deployment to any server that can run Swift. The Vapor CLI tool makes deployment to Heroku super simple.

If your Vapor app is not already in a Git repository we’ll need to add one. Run the following commands from your project directory: