Yet Another Sinatra Boilerplate


A few days ago I started my first web application with a Sinatra infrastructure. Coming mostly from the Ruby on Rails world, I was amazed to see how many of the basic features we take for granted in our Rails application, are hard to set up or even not existing in a Sinatra application.
Sinatra is a really lean web framework – most of it is concentrated in a single 2000+ LOC file that defines it. That’s great because it gives us the opportunity to build small and fast web services with minimum overhead per request. It does come with a price though: you’re going to find yourself repeating some very basic setup operations in each of the new projects you start with Sinatra.

We’re developers => We’re lazy => We don’t like repeating ourselves

This made me come up with a Sinatra boilerplate that contains the very basic project setup that I think every web project must have. I’m sure that everyone who started a Sinatra project implemented the boilerplate’s features in one way or another. Let’s take a peak on its features:

1. A Ruby on Rails like directory structure to organize your project.
2. An app loader that will load your Sinatra environment.
3. Rspec + Guard + Spork configured and ready to fire so you can test your app.
4. A Sinatra console in which you can interactively work with your app.
5. Multiple environments configuration support.
6. Unicorn configuration template.
7. Capistrano deployment template.
8. God configuration that will keep your site always up.
9. Airbrake integration for error reporting.
10. Auto-loads changed files on development environment for fast development.

Check it out here. It will make your development faster, easier and more productive.


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