Friday, 30 December 2016

Sails vs Trails

Now a days so many frameworks are populating and some of them are gaining the interest from communities.So sails and trails are also a web framework so we start with basic introduction on both.

Sails vs Trails Node.js

TrailsJS : Trails is a modern, community-driven web application framework for node.js. It builds on the pedigree of Rails and Grails to accelerate development by adhering to a straightforward, convention-based, API-driven design philosophy.

Creator: Travis Webb
GitHub: (1431+ stars) 
Age: 1+ year (release on 3rd Dec, 2015)
Support: Express4/5, Hapi, Koa, Restify
+1 Features: ES6, Trailpack, Footprint, Microservices
RealTime: Primus,, (Externally)
DB: MongoDB, MySql, Postgres, Redis, RethinkDB
ORM: Mongoose, Waterline, Knex & more…

SailsJS : Sails.js is a web framework that makes it easy to build custom, enterprise-grade Node.js apps.It is designed to resemble the MVC architecture from frameworks like Ruby on Rails, but with support for the more modern, data-oriented style of web app development. It's especially good for building realtime features like chat.

Creator: Mike McNeil
GitHub: (16k+ stars)     
Age: 4+ year (release on 25th Jun, 2012)
Support: Express3/4
+1 Features: Hooks, Blueprint
RealTime: (Inbuilt)
DB: MongoDB, MySql, Postgres, Redis and more…
ORM: Waterline & other

Similarity in both :

Automatic REST APIs from models : Sails uses blueprint while Trails users footprints.

MVC : Both these frameworks are uses MVC pattern in default but with the trailsJS you can do a code with different pattern also. It supports multiple web framework & dynamic file loading.

Support web-sockets for real time : Sails comes with inbuilt supports like pub-sub & socket-client.In trails you don't have a directly support you can configure it manually.Some trailpacks for real-time support. trailpack-realtime & trailpack-pubsub.

Support multiple databases : Both supports almost all major databases like MongoDB, MySQL, Redis, CouchDB.

Plugin system : Trails has plugins system like trailpack & microservices.Sails comes with plugin system named Hook.

Policies & Services : Both using same architecture and usage for (

How they are differ :

File loading : Sails loads all files under apis & config folders on start up (sails lift). It loads file at startup so it cause of all loading server slowly.So when your project size will be increased so startup time of server also increased. Trails will not loaded automatically. In trails every thing is loaded using index.js file so you can manage with that file.

ORM : Sails default orm is waterline. you can disbale it to use another one. Trails supports multiple ORM's like mongoose etc.

ECMAScript : Sails is built with ECMAScript 5. So It can run with Node ≥ 0.11 and Trails is built with ECMAScript15 (es6). So trails need node ≥ 4.0.

Web Server : Sails uses (built upon) Express3 (deprecated) as a web server so this will be main drawback of sails .Trails’s main advantage is It’s not built upon but built besides.

I hope you like the post please comment and share.

Featured post

How to create dynamic schema in mongodb

Sometime what we need in our application is to create mongodb schema for collection and some of our collection schema are same but names are...

Popular Posts