Sails.js vs Meteor - What are the advantages of both?

pedropeixoto picture pedropeixoto · Mar 5, 2014 · Viewed 51.3k times · Source

I've been reading a lot on Nodejs and its frameworks and recently finished my first full javascript frontend (using Angularjs).

I've decided that my next pet project will be a Nodejs adventure using one of these two frameworks:

I've read about both, but still can't quite grasp their differences and why should I choose to use one over the other. So please put on your best salesman hat, pick a framework, and sell it me.

Some features I require for my pet project are:

  • Live scores
  • Reddit-like threads, realtime
  • Wikipedia-like page edition
  • Users/Roles

Answer

mikermcneil picture mikermcneil · Mar 27, 2014

I can't speak for Meteor, but I can help provide a little background on Sails because I created it.

tldr; Sails is not a panacea for all of the web's problems-- but I believe Node.js is. The goal of Sails is to provide a practical framework for developing complete, scalable, startup and enterprise-friendly applications built on node.js. I started Balderdash with the question "Can we use Node.js for everything?". Sails is the answer.


From our new docs:

Sails is, of course, a web framework. But take a step back. What does that mean? Sometimes, when we refer to the "web", we mean the "front-end web." We think of concepts like web standards, or HTML 5, or CSS 3; and frameworks like Backbone, or Angular, or jQuery. Sails is not "that kind" of a web framework. Sails works great with Angular and Backbone, but you would never use Sails instead of those libraries.

On the other hand, sometimes when we talk about "web frameworks", we mean the "back-end web." This evokes concepts like REST, or HTTP, or WebSockets; and is built on technologies like Java, or Ruby, or Node.js. A "back-end web" framework helps you do things like build APIs, interact with databases, serve HTML files, and handle hundreds of thousands of simultaneous users. Sails is "that kind" of web framework.

A couple of years ago, I made a commitment to use Node.js for everything- it was love at first sight. I built Sails on top of Express and Socket.io because they were (and still are) the most well-established Node modules for their respective use cases. The request-handling code in Sails is Express-compatible, with the additional advantage of implicit support for Socket.io.

Sails is designed to be compatible with whatever strategy you have for building your front-end(s) in Angular, Backbone, iOS/ObjC, Android/Java, or even just offering up a raw API to be used by another web service or your developer community. If you end up changing your approach (e.g. switching from Backbone to Angular) or building a new front-end entirely (e.g. building a Windows Phone native app), your Sails app will still work. As you may already know, some people call this approach a Service Oriented Architecture, or SOA (Joe McCann has a great deck on the subject.)

Along the same lines, Sails maintains other familiar conventions for building web servers-- a standard MVC structure, the ability to create clean APIs, and core modules which are open, configurable, extensible, and even swappable. This means that Sails can be customized to fit its users' needs, as low-level as is necessary.

In 2013, the framework experienced some tremendous growth in popularity, and our consulting business grew. The rest of the core maintainers and I broadened our focus on making backend development as quick and straightforward as possible. Related aspects of Sails like hooks (plugins), testing and docs have all come a long way over the last year thanks to the efforts of both our core team and the (ever-expanding) Sails community at large. There are plenty of roadmap items that we're still working on, but I believe Sails is the best option out there for stable, maintainable MVC development on Node today. The rest of the team and I are committed to its continued maintenance and feature development, and since we use it for all of our client projects, it's not going anywhere.

I am head-over-heels committed to making Sails the best web framework out there, but never at the expense of Node.js. The core team and I are relentlessly devoted to the enhancement of the Node ecosystem, and that means embracing NPM, leveraging existing Node technologies and best practices, etc. Not just because it makes more sense, but because we're Node.js developers. The motivation for all of our efforts is to make Node more accessible, not to supersede it. So, if, in some weird parallel universe, I was given a Faustian choice between converting Sails to some other language, or completely ditching Sails but still being able to use Node, I would pick the latter.


Additional Resources:

FAQ | Sails 101 | Original screencast | Contribution Guide | Stackoverflow

Google Group | Roadmap | IRC: #sailsjs on Freenode | Build Status