Skip to content
Search engines 5511dd3

Tool of the Week - Sinatra

MelGray

The author's views are entirely their own (excluding the unlikely event of hypnosis) and may not always reflect the views of Moz.

Table of Contents

MelGray

Tool of the Week - Sinatra

The author's views are entirely their own (excluding the unlikely event of hypnosis) and may not always reflect the views of Moz.

Ladies and Gents, this weeks' featured tool is a cool little number that's really gotten under our skin here at the office.



Sinatra is a ruby based web development framework that is targeted for very small projects.  It is not your typical web framework, as the the entire code base (with built in documentation sans tests) weighs in at 1162 lines of code.  It is substantially different from other frameworks like CakePHP or Ruby on Rails because the applications typically reside in a single file.

In fact, most applications built using Sinatra are only a handful of lines long.  Take the following example for the classic "Hello World" app:



When run, the above code will fire up a small web server that will greet you with "Hello World" when "/" is accessed.

Many of you out there may be asking yourself, "What is the use of that?" Well, I'll lift a quote from old blue eyes himself:
"I'm not one of those complicated, mixed-up cats. I'm not looking for the secret to life.... I just go on from day to day, taking what comes." -Frank Sinatra
Mr. Sinatra was obviously a minimalist.  A simple man that liked to sing songs.... Sing songs and hang out with the President of the United States, Marilyn Monroe, and the mob.

Anyway, most frameworks are overkill for simple projects. Larger frameworks are great for sites that need to do a lot of heaving lifting, but more often than not they're simply too big for little tasks.  Would you use a jackhammer to hang a picture? Big solutions don't make sense for little problems.

Need a quick web interface to a database?  Sinatra can handle it. Need to build a simple Facebook app? Sinatra knows that diddy too. Have an idea for an application that could make killer linkbait? Sinatra could sit in. Any small task that you need to accomplish over the web, Sinatra can help you accomplish, with minimal effort.

That being said, I will give you guys a head up and say that Sinatra is young and won't take care of everything for you. We used Sinatra to build an application we're using behind the scenes here at the Mozplex. While it offered the benefit of "immediate results," as time went on we found ourselves adding more and more features to it.  Our simple little app started becoming more and more complex. When we tried introducing tests into the application to keep it maintainable, the results were not so immediate. That being said, your mileage may vary with Sinatra.  However, for those small tasks where you need to get something done immediately, it can be a life saver.

If you're interested in some apps that are powered or used by Sinatra, here are some links to check out:

http://github.com/deadprogrammer/frankie/tree/master
http://atonie.org/2008/02/git-wiki
http://carlosgabaldon.com/calabro/blog/post/2008/04/14/Singing_with_Sinatra

If you're interested in another framework that is similar in nature to Sinatra, I highly recommend Ramaze.  It is very polished, very thoroughly documented, and has an extremely friendly community behind it.

That's it for this week. I apologize for the lengthiness of this article, but "I Just Couldn't Say Goodbye."

EDIT:
I still can't say goodbye.  I forgot to add two more links that may help demonstrate how quickly you can get up and running with Sinatra.

Tasty little screencast:
http://www.xnot.org/sinatra/movies/intro_1.mov

Useful beginners guide:
http://www.xnot.org/sinatra/beginning.html
Back to Top

With Moz Pro, you have the tools you need to get SEO right — all in one place.

Read Next

How to Optimize E-commerce Sitemaps with 1M+ Pages — Whiteboard Friday

How to Optimize E-commerce Sitemaps with 1M+ Pages — Whiteboard Friday

May 17, 2024
7 Ways SEO and Product Teams Can Collaborate to Ensure Success

7 Ways SEO and Product Teams Can Collaborate to Ensure Success

Apr 24, 2024
6 Things SEOs Should Advocate for When Building a Headless Website — Whiteboard Friday

6 Things SEOs Should Advocate for When Building a Headless Website — Whiteboard Friday

Apr 19, 2024

Comments

Please keep your comments TAGFEE by following the community etiquette

Comments are closed. Got a burning question? Head to our Q&A section to start a new conversation.