Deploying a Vapor App to Vapor Cloud (Vapor 2.3, Swift 4/Xcode9)


Vapor Cloud is a cloud hosting platform built specifically for the Vapor framework. It was built and is maintained by the Vapor team as well, not a third party provider. This tutorial will go over how to deploy a Vapor app to Vapor Cloud, starting from scratch--from signup to live deployment. Let's begin!


To do this tutorial:

  • You must have Vapor and Vapor toolbox installed
  • You must be running in Xcode 9 +
  • When you run $ swift --version in terminal, it should indicate you are running Swift 4.0+
  • When you run $ swift package tools-version in terminal, it should indicate you are running swift tools version 4.0.0 or higher

Part 1: Creating account and Project Setup on Vapor Cloud site

First, head to []( and sign up for an account.

After creating your account, you will be redirected to the Login Page. Login, and you will be redirected to the dashboard. At this point, your dashboard should just look like:

Click on the name of your Organization (for me, this is TestingTutorial). You will then be redirected to the home page for that organization. Then, click on the green + to add a project:

Give your project a name:

And then click Create Project. Upon successful creation, you will be redirected to the page for this individual project. It should look like:

Part 2: Creating the Vapor Project

In terminal, create a new Vapor Project by running:

    $ vapor new VaporCloudTutorial --template=api

Then cd into the new project:

    $ cd VaporCloudTutorial

then, create the Xcode project by running:

    $ vapor xcode

When promoted to open the Xcode Project, respond "y".

Next, navigate to your project's root directory, and find a file called cloud.yml.

  • Note: If you are using this tutorial for another project that was generated with the Vapor web template, this file is not included by default, and you must create it.

Change the contents of this file to read exactly:

    swift_version: "4.0.0"
    type: "vapor"

This is to tell Vapor Cloud to compile with Swift 4.0. At this point, your project directory should look like:

Part 3: Create a public git repository

Create a git repository for your app. We will need the URL of the repository soon. For example, the URL for my example is

Part 4: Deploying to Vapor Cloud

First, log into vapor cloud in terminal. Run:

    $ vapor cloud login

And enter your credentials. Upon successful login, it should say (I have blurred out my email for privacy):

Now, run:

    $ vapor cloud deploy

You will see:

    $ Would you like to create an application now?

Respond "y"

Then you will see:

    $ Which project?
    1: VaporCloudTestingProject <>

(The name of your project will be here), for me, mine is "VaporCloudTestingProject").

Press 1 to select your project, and then Enter.

Then, you will see:

    $ What name for this application?

Enter a name and press Enter. I entered "VaporCloudTestingApplictation"

Next, you will see:

    $ What slug for this application?

The slug is the url prefix for your site. For example, if your slug is vaporCloudTesting, then once deployed, your site will be visible at I am choosing vaporCloudTesting for my slug.

You'll then see a prompt asking if the above information is correct. If it is, respond with y.

The next question is:

    $ Would you like to add hosting?

Respond with y.

You should then see:

    $ Detected Git, to manually choose a URL use the --gitURL option.
    $ Which Git URL?

If the first option listed is correct (and if you have followed step by step in this tutorial, it should be), then respond with 1. You'll then be prompted asking if everything is still correct.

Next is creating an environment. You'll see:

    $ Create environment: vapor cloud create env
    $ Would you like to create an environment now?

Respond with y. For our purposes, we will only create a production environment now, but you can also create other environments (such as dev), which are then accessible via that environments sub-domain. A dev environment for my app would then be accessible at

Next you'll see:

    $ What name for this environment?

Respond with "production".


    $ What 'git' branch should we deploy for this Environment?

Respond with "master". If your app has another branch you would like to deploy from, simply enter that branches name instead. You can then choose your package:

    $ What size replica(s)?
    1: Free ($0/month)
    2: Hobby ($6/month)
    3: Small ($30/month)
    4: Medium ($65/month)
    5: Large ($225/month)
    6: X-Large ($375/month)

For our purposes, just choose 1, since this is just a demo. You'll then be asked if everything is correct. Respond accordingly.

Next you'll be asked about adding a database:

    $ Would you like to add a database?

Respond n. I will cover this in a later tutorial, but for now we'll keep it simple.

Then you'll see:

    $ Which build type?
    1: incremental (fastest: just compile the code)
    2: update (normal: update dependencies before compiling)
    3: clean (slowest: clear cached dependencies and build data before compiling)

We will choose 1. You should then see the deployment process starting to take place:

This may take several minutes to complete. At the end, you should see:

Now, navigate to (mine is and you should see:


It's complete! You just deployed your first app to vapor cloud! Hope you found this tutorial useful. In the next Vapor cloud tutorial, we will go over adding a database and creating a dev environment. Have a good one!