Sails is a MVC architecture for Node.js, like Django to Python or Ruby on Rails to
Ruby, it has support for the more modern, data-oriented style of web app
It's especially good for building APIs, single apps/sites, realtime features like chat,
analytics dashboard and multiplayer games.
brew install node
sudo npm -g install sails
sails new <appName>
What Sails can do
Socket.io / Realtime / WebSockets
Supports transport agnostic routing, which allows your controllers/policies to
automatically handle Socket.io / WebSocket messages. In the past, you'd have to
maintain a separate code base to make that happen.
Built-in support for Redis session store, and Redis MQ for reverse pubsub routing.
Supports the existing ecosystem of Express middleware.
Automatically generated JSON API for manipulating models
Automatic route bindings for your controller actions
Sails provides an ORM (Object Relational Mapping) called Waterline.
Waterline not suports databases and associations yet, but are on the immediate
They can be chained together to protec or preprocess requests for controllers.
E.g. authentication logic, role-based access control, ﬁle storage quotas.
Support for Grunt
Grunt was added in Sails v0.9. Modifying the Gruntﬁle you can easy add support
for your favorite template engine or css/js preprocessor.
Sails bundles support for LESS and JST Templates. Modifying your app's Gruntﬁle,
you can add support for SASS, Handlebars, CoﬀeeScript, Stylus, TypeScript, etc.
has the same philosophy from other frameworks like Rails, Django, Zend.
are EJS by default, but you can set Jade, etc
are just Express Middleware.
Products app example
Create Product Model:
sails generate product
This command line create 2 ﬁles:
Now open/edit the Product.js model.
After a controller has been deﬁned, Sails will automatically map out routes to give you
Now create some products:
Seeing product realtime list
1. Edit app.js ﬁle to list all products:
2. Create products in other browser window and see the console.log in the
1. Add MySQL support;
2. Assciate Product with Category model;
3. Choose AngularJS or Backbone.js as front-end framework.
Community is growing fast!
It can be a great full stack framework to production use soon.
3.456 starts and 339 forks on
Active IRC channel;