Introduction
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
development.
It's especially good for building APIs, single apps/sites, realtime features like chat,
analytics dashboard and multiplayer games.

Running
brew install node
sudo npm -g install sails
sails new <appName>
sails lift
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.

Performance
Built-in support for Redis session store, and Redis MQ for reverse pubsub routing.

Express
Supports the existing ecosystem of Express middleware.

REST Blueprints
Automatically generated JSON API for manipulating models
Automatic route bindings for your controller actions
Lightweight ORM
Sails provides an ORM (Object Relational Mapping) called Waterline.
Waterline not suports databases and associations yet, but are on the immediate
todo list.

Policies
They can be chained together to protec or preprocess requests for controllers.
E.g. authentication logic, role-based access control, file storage quotas.

Support for Grunt
Grunt was added in Sails v0.9. Modifying the Gruntfile you can easy add support
for your favorite template engine or css/js preprocessor.

Asset bundling
Sails bundles support for LESS and JST Templates. Modifying your app's Gruntfile,
you can add support for SASS, Handlebars, CoffeeScript, Stylus, TypeScript, etc.
MVC structure
Model
has the same philosophy from other frameworks like Rails, Django, Zend.

View
are EJS by default, but you can set Jade, etc

Controller
are just Express Middleware.
Products app example
Create Product Model:
sails generate product
This command line create 2 files:
/api/controllers/ProductController.js
/api/models/Product.js
Now open/edit the Product.js model.
Product Model
Product Controller
After a controller has been defined, Sails will automatically map out routes to give you
easy access.
get /:controller/:id?
post /:controller
put /:controller/:id
delete /:controller/:id
/:controller/find/:id?
/:controller/create
/:controller/update/:id
/:controller/destroy/:id
Now create some products:
http://localhost:1337/product/create/?name=Shoe1&description=Desc&price=20.30
Seeing product realtime list
1. Edit app.js file to list all products:

2. Create products in other browser window and see the console.log in the
http://localhost:1337:
Next steps
1. Add MySQL support;
2. Assciate Product with Category model;
3. Choose AngularJS or Backbone.js as front-end framework.
Currents status
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;
Google Group.
Thanks!
Leo Berdu
@leoberdu

Resources

http://sailsjs.org
https://groups.google.com/forum/#!forum/sailsjs
http://nodejs.org/
https://github.com/joyent/node/wiki/modules#wiki-web-frameworks-full

Sails Framework Instroduction

  • 2.
    Introduction Sails is aMVC 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 development. It's especially good for building APIs, single apps/sites, realtime features like chat, analytics dashboard and multiplayer games. Running brew install node sudo npm -g install sails sails new <appName> sails lift
  • 3.
    What Sails cando 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. Performance Built-in support for Redis session store, and Redis MQ for reverse pubsub routing. Express Supports the existing ecosystem of Express middleware. REST Blueprints Automatically generated JSON API for manipulating models Automatic route bindings for your controller actions
  • 4.
    Lightweight ORM Sails providesan ORM (Object Relational Mapping) called Waterline. Waterline not suports databases and associations yet, but are on the immediate todo list. Policies They can be chained together to protec or preprocess requests for controllers. E.g. authentication logic, role-based access control, file storage quotas. Support for Grunt Grunt was added in Sails v0.9. Modifying the Gruntfile you can easy add support for your favorite template engine or css/js preprocessor. Asset bundling Sails bundles support for LESS and JST Templates. Modifying your app's Gruntfile, you can add support for SASS, Handlebars, CoffeeScript, Stylus, TypeScript, etc.
  • 5.
    MVC structure Model has thesame philosophy from other frameworks like Rails, Django, Zend. View are EJS by default, but you can set Jade, etc Controller are just Express Middleware.
  • 6.
    Products app example CreateProduct Model: sails generate product This command line create 2 files: /api/controllers/ProductController.js /api/models/Product.js Now open/edit the Product.js model.
  • 7.
  • 8.
    Product Controller After acontroller has been defined, Sails will automatically map out routes to give you easy access. get /:controller/:id? post /:controller put /:controller/:id delete /:controller/:id /:controller/find/:id? /:controller/create /:controller/update/:id /:controller/destroy/:id Now create some products: http://localhost:1337/product/create/?name=Shoe1&description=Desc&price=20.30
  • 9.
    Seeing product realtimelist 1. Edit app.js file to list all products: 2. Create products in other browser window and see the console.log in the http://localhost:1337:
  • 10.
    Next steps 1. AddMySQL support; 2. Assciate Product with Category model; 3. Choose AngularJS or Backbone.js as front-end framework.
  • 11.
    Currents status Community isgrowing fast! It can be a great full stack framework to production use soon. 3.456 starts and 339 forks on Active IRC channel; Google Group.
  • 12.