Skip to content
Starting point for using the Vapor framework.
Branch: master
Clone or download
tanner0101 Merge pull request #52 from mludi/master
update to newest vapor version and removed errors
Latest commit 2159b28 Jan 20, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
Localization vapor 0.9 updates May 26, 2016
Public update to 0.14 Jul 13, 2016
Resources/Views linux is case sensitive Aug 31, 2016
Sources/App update to newest vapor version and removed errors Dec 28, 2016
.swift-version gm Sep 12, 2016
.travis.yml le trav Aug 31, 2016
Package.swift update to newest vapor version and removed errors Dec 28, 2016
Procfile Update Jul 15, 2016
app.json copy vapor servers.json Jul 13, 2016
license Add MIT license Jul 14, 2016

Vapor Example

Fork this example project as a boilerplate for working with Vapor.

Check out the live demo running on Ubuntu.


Build Status PRs Welcome Slack Status




View Vapor for documentation.


Swift 3.0 preview 2 is required (Xcode 8 beta 2 on macOS).

Works on Ubuntu, Docker, Heroku, macOS.

Run the following script to check if you have Swift 3.0 beta 2 properly installed and configured.

curl -sL | bash


Visit Getting Started in the documentation.


If you have the Vapor Toolbox, use vapor new <project-name> to create your new application.

Then run vapor build and vapor run.

Otherwise, clone this repo and run swift build to compile your application, then run .build/debug/App.

Xcode 8

Run vapor xcode which will create the Xcode Project and open Xcode 8.



Check the Vapor documentation for more in-depth deployment instructions.


To start your Vapor site automatically when the server is booted, add this file to your server.

You can check if Upstart is installed with

initctl --version

You may need to install Upstart if it is not already on your installation of Linux.

sudo apt-get install upstart


description "Vapor Example"

start on startup

env PORT=8080

exec /home/<user_name>/vapor-example/.build/release/App --env=production

You additionally have access to the following commands for starting and stopping your server.

sudo stop vapor-example
sudo start vapor-example

The following script is useful for upgrading your website.

git pull
swift build --configuration release
sudo stop vapor-example
sudo start vapor-example


Use the vapor heroku commands in the Vapor Toolbox to push to Heroku.


You can run this demo application locally in a Linux environment using Docker.

Make sure you have installed the Vapor Toolbox.

  1. Ensure Docker is installed on your local machine.
  2. Start the Docker terminal
  3. cd into vapor-example
  4. Create the Dockerfile vapor docker init
  5. Build the container vapor docker build
  6. Run the container vapor docker run
  7. Optionally enter the container vapor docker enter
  8. Configure VirtualBox to forward ports 8080 to 8080
  9. Visit

Nginx / Supervisor

You can also run your Vapor app through Nginx. It’s recommended you use Supervisor to run the app instance to protect against crashes and ensure it’s always running.


To setup Vapor running through Supervisor, follow these steps:

apt-get install -y supervisor

Edit the config below to match your environment and place it in /etc/supervisor/conf.d/your-app.conf:

command=/path/to/app/.build/release/App serve --ip= --port=8080

Now register the app with Supervisor and start it up:

supervisorctl reread
supervisorctl add your-app
supervisorctl start your-app # `add` may have auto-started, so disregard an “already started” error here


With the app now running via Supervisor, you can use this sample nginx config to proxy it through Nginx:

server {
	listen 80;

	root /path/to/app/Public;

	# Serve all public/static files via nginx and then fallback to Vapor for the rest
	try_files $uri @proxy;

	location @proxy {
		# Make sure the port here matches the port in your Supervisor config
		proxy_pass_header Server;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_connect_timeout 3s;
		proxy_read_timeout 10s;
You can’t perform that action at this time.