9

I am in the process of developing a new website. The level of complexity of the site would be somewhere on the order of Yelp.com. I am pretty new to Ruby but decided I want to develop the backend using it. In the process I stumbled across Sinatra. I really love the simplicity of the routing in Sinatra and decided to use it as the starting point for my development. It seems most places say Sinatra is great for quick development and for "small web apps." Is there an inherent scaling problem with Sinatra or are the comments stemming from the fact that you basically have to build everything up from scratch? Any comments regarding your opinion about using Sinatra as the basis for a large scale web app would be appreciated.

I'm not sure if stackoverflow is the correct place to ask an opinion question such as this, but it's the only resource I currently have at my disposal to actually get some feedback about something like this.

2 Answers 2

9

I've built my last two fairly complex projects using Sinatra and have enjoyed the process. What I like is that it encourages you to consider the API of the web application you are building up-front rather than as an afterthought.

What I tend to do now is get the API working and tested and then build the browser-facing front-end using jQuery. All interaction between the front end and the back is done via the API.

By breaking out helper methods into separate libraries and taking advantage of Ruby on Rails libs like ActiveRecord etc I find the code is no harder to maintain than any other code I have written, and it's certainly easy to test.

I've written some simple generic routes that allow me to cluster page level content (either written in markdown, textile, or haml) using similar ideas to the Nesta project which means that 99% of my routes are API calls rather than page-display calls. I've added some neat helpers for rule based navigation construction too that really help too.

So in short the answer is no, there is nothing wrong with building large websites with Sinatra, and in fact I believe it can lead to better designed web applications.

1
  • I'm a little unfamiliar with this api vs. page call philosophy. Could you point me to a source to read further? Thanks for the response, btw.
    – wuliwong
    Dec 14, 2011 at 4:48
4

Building a Big site with Sinatra will not face you with scaling problems, but will definitely give u a very hard time maintaining code. Although i love Sinatra, convention over configuration in rails wins hands down. Also note that it isnt wrong/bad/impossible to use Sinatra for a huge site, just that it is hard doing it right and you would not want yourself regretting later. If you still are stubborn in using Sinatra you can try Padrino which is basically a wrapper over Sinatra(I have never used it so cant help you about that)

2
  • I have heard of Padrino and what you are saying about convention is something I'm worry about. I'll definitely look into Padrino. Thanks!
    – wuliwong
    Dec 14, 2011 at 4:46
  • Just a little further comment on Padrino, they recommend learning Sinatra first and they say that you can usually include what you've done with Sinatra into a Padrino app. Sounds a little too magical, but Padrino is pretty modular so you can pick and choose pieces of it without having to use the entire framework if you so choose.
    – wuliwong
    Dec 15, 2011 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.