Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is anything wrong with using Sinatra to develop a full website?

Tags:

ruby

web

sinatra

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.

like image 391
wuliwong Avatar asked Feb 03 '23 10:02

wuliwong


1 Answers

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.

like image 157
Dave Sag Avatar answered Feb 05 '23 02:02

Dave Sag