Deploy Sinatra app on Heroku

This is for everyone who has finished their Sinatra application and wants to deploy it on Heroku.

FYI::You will need to have all your files uploaded on your Github repo to be able to deploy on Heroku. The following steps are assuming you have deployed to Heroku before. If you haven’t, follow this excellent tutorial.

Example app name: Hangman
app file: game/hangman.rb


1. Create a Gemfile in your app directory that has the following:
The file path should look something like this: game/Gemfile where ‘game’ is the name of your app directory

source ''
gem 'sinatra'
gem 'sinatra-contrib'

Be sure it list ALL gems you use in this Gemfile otherwise Heroku will give you an H10 – App Crashed error.

2. Create a file in your app directory:
The file path should look something like this: game/

require './hangman'
run Sinatra::Application

3. In your app file (ie. hangman.rb), require Sinatra:

require 'sinatra'

If you don’t have any content in the file, create a simple Hello World by adding the following below your require statement:

get '/' do
  "Hello World!"

4. Run Bundle Update
In your terminal (or Command Prompt):

$ bundle update

This will create and update your Gemfile.lock.
You can also manually create a Gemfile.lock and run bundle update after.

5. Commit your new files to Github and push to Heroku!

$ git add Gemfile Gemfile.lock
$ git commit -m "adding Heroku deployment files"
$ git push origin master
$ git push heroku master

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s