Course List >> Ruby on Rails >> Sinatra >> Project: Sinatra Project
Scroll up or hover over the breadcrumbs to view the navigation bar

Sinatra Project

Don't forget to use Git to save your projects!

You've seen how simple it can be to get something up and running using Sinatra, in these projects you will use the Caesar Cipher and either the Hangman or Mastermind games you built in the Ruby course to make a couple of web apps.

A note on deploying your apps

Deploying a Sinatra app to Heroku takes a little bit of work but the process is fairly straightforward. Instructions can be found here

  1. your config.ru file should require your main application file (This will be something like web_guesser.rb in the jumpstart tutorial)
  2. if you are using sinatra/reloader, you need to remove or comment out that line before pushing to Heroku. Alternatively you can add if development? to that line and Heroku will automatically know not to use it (and it will still work locally!).
  3. after creating your Gemfile, you need to run bundle install and add/commit the files to git before pushing to Heroku.

Project 1: Caesar Cipher reloaded

Revisit the caesar cipher ruby script that you created during Ruby Building Blocks and use Sinatra to create a simple front-end for it.

Your Task

  1. Start a new Sinatra project (you can begin by doing a simple hello world as in the Jumpstart tutorial, just to make sure everything is set up correctly)
  2. You should be able to do this with only one view, and a couple of routes, but feel free to be as fancy as you like.
  3. Deploy to Heroku!

Student Solutions

Send us your solution so we can show others! Submit a link to the Github repo with your files in it here using any of the methods listed on the contributing page. Please include your partner's github handle somewhere in the description if they would like attribution.

Project 2: Another Web-Game

Pick either Mastermind or Hangman and build a front end for it. This one might take a little more work, but it should be well within your grasp at this point. Have fun!

Your Task

  1. The UI-implementation is up to you this time. Keeping them text-based is acceptable, but now that we're on the web you can branch out with images to make something a little nicer.
  2. You'll probably want to go over the use of "sessions" within Sinatra again. Check the README and here.
  3. Have fun! Don't forget to make all of your friends play your game!
  4. Extra Credit The free Heroku account only allows a limited number of projects, unless you add a credit card to your account (they won't charge you, it's just for identity confirmation). If you do add your information, you can have unlimited projects, but they still limit how many of them can be "awake" at one time. You might consider using Sinatra to make yourself a simple web-portfolio so that you can store all of these apps in one project.

Student Solutions

Send us your solution so we can show others! Submit a link to the Github repo with your files in it here using any of the methods listed on the contributing page. Please include your partner's github handle somewhere in the description if they would like attribution.

From the creators of The Odin Project...

The Viking Code School
Viking ad 180x150