Search code examples
node.jsbackendddp

Which NodeJS frameworks are suitable to build a complete backend for a Nativescript app (JS-based)?


I am now building a native mobile application in Nativescript, leveraging my JS knowledge.

So, I though to switch to some other Nodejs framework.

My app's backend requirements will be:

  • pure JS
  • complete backend logic (i.e. controller)
  • connect to a MongoDB database
  • RESTful
  • non-frontend-dependent
  • non-DOM-dependent
  • easy-yet-complete to use: should be a framework which gives strong foundations to make a solid and efficient backend for a (relatively) inexperienced backend developer (except for Java basics and experience with pure PHP)

I was considering using my existing knowledge of Meteor but I can't implement any existing experiment of using ddp and websockets in it.

Some of the possibilities I was considering to give a try to:

  • Loopback
  • Total.js
  • Hapi.js
  • Sail.js
  • I am fine with any JS-based framework, whether it's NodeJS based or not
  • I am also open to a REST API solution which exposes Meteor backend, as long as is doesn't require ddp to be usable (it's not very clear to me what are the limits of non using DDP when using Meteor)

Any concrete advice, which would eventually avoid me trying all of them, before discovering they don't work with Nativescript or don't satisfy my requirements?


Solution

  • SailsJs is a wrapper around express.js with many add-ons and shortcuts that eases your life and shortens the code required to write, and it's very much suitable to write RESTful apps.

    HAPI and Total, I didn't use them myself, but there are very good reviews about them, but when it comes to Sails, it's the highest in popularity, hence, better tested and used, which leads to a more mature framework over the time.

    Loopback is good, but it requires payment at some point of usage, and still Sails is more popular.

    Meteor.js is great, but it's not the right tool for that job, and it might take you more effort to make it as an easy to use RESTful framework, not to mention the un-needed memory and processing overhead, which has it's uses, but not in RESTful case. I tried to use it to write RESTful apps but didn't feel the ease and the low memory footprint as I experienced with express and Sails.

    Update

    Sails has clear and easy to use MVC style, with a command line to generate apis, configure-and-fine-tune-later APIs style, which is very much needed in prototyping and PoC applications, as well as short time to market.

    Update 2

    Sails ORM supports both SQL and NoSQL DBs, with dozen of supported drivers out there