{"id":537,"date":"2019-09-26T15:58:34","date_gmt":"2019-09-26T15:58:34","guid":{"rendered":"https:\/\/www.iseeahappyface.com\/?p=537"},"modified":"2019-09-26T15:58:34","modified_gmt":"2019-09-26T15:58:34","slug":"the-six-biggest-node-js-frameworks-2019-pros-and-cons","status":"publish","type":"post","link":"https:\/\/www.iseeahappyface.com\/the-six-biggest-node-js-frameworks-2019-pros-and-cons\/","title":{"rendered":"The Six Biggest Node.js Frameworks 2019: Pros and Cons"},"content":{"rendered":"

Node is here to stay. When people first started talking about extending JavaScript into the backend, it was met with confusion at best and derision at worst, but it\u2019s now one of the tentpoles of tech. It\u2019s often the default backend pick for real-time applications and with good reason: its single-threaded and event-driven nature makes it almost unparalleled at handling a high volume of real-time traffic. Unlike other web application technologies like PHP, ASP.NET, JSP and Spring MVC, which instantiate a new thread for a client request, NodeJS apps use the \u201cSingle Threaded Event Loop Model\u201d, where the main event loop is on a single thread, and most of the I\/O uses different threads.<\/p>\n

Today, we\u2019ll be going over the six biggest Node frameworks: their strengths, their weaknesses, and when it\u2019s the right time to use them.<\/p>\n

Express.js <\/strong><\/p>\n

Yep, still the champ, and with good reason. Express is a simple, lightweight framework that has\u2014in JS terms\u2014stood the test of time. It has a powerful and versatile middleware interface that few other frameworks can match; since Express has been the default framework for so many years, basically any third-party NPM module you can think of is going to be compatible. Express has built up a tremendous momentum, and it doesn\u2019t look to be slowing down any time soon.<\/p>\n

On the other hand, it\u2019s a bit of a blunt instrument. It often results in awkward, buggy code and lays down landmines for future developers. It\u2019s a perfectly respectable framework for most jobs<\/em>, but it can struggle with specialist work.<\/p>\n

That said, it\u2019s not going anywhere. Express is to JS what Bootstrap is to CSS or Google is to search engines\u2014it\u2019s not always<\/em> the best choice, but it\u2019s usually the best choice and that\u2019s more than enough.<\/p>\n

Meteor.js<\/strong><\/p>\n

Meteor\u2019s popularity has declined with each passing year, and I\u2019m not sure it\u2019s going to stick around for much longer. I\u2019d be strung up if I didn\u2019t include it, but it feels like a bit of a dinosaur, getting constantly outmaneuvered by newer, more streamlined frameworks.<\/p>\n

It\u2019s still a very powerful framework, with power <\/em>being the operative word; Meteor has a ton of features and a thriving NPM ecosystem. The other big frameworks are all stripped-down and built for speed, but Meteor boasts that it\u2019s a full-stack package. It hasn\u2019t entirely been obsoleted because there\u2019s nothing else that has quite the same amount of functionality right out of the box. Its Isobuild automation tool makes mobile app construction a breeze.<\/p>\n

Meteor is big, solid, heavy and inflexible. If it\u2019s the right fit then it\u2019s a perfect<\/em> fit, but it doesn\u2019t have the maneuverability or versatility of Express.<\/p>\n

Sails.js<\/strong><\/p>\n

Sails has the wonderful Waterline ORM, which is similar to Mongoose ORM commonly used with Express but can work with a broader range of databases. Express is very tightly integrated with the MEAN stack, but Sails lets you use SQL databases and<\/em> a broader range of noSQL databases. Sails also has a great team and great documentation, though I haven\u2019t found the community as good at answering questions as larger frameworks like Express. Sails is also famously good at handling callbacks and keeping you out of callback hell.<\/p>\n

One downside is that Waterline doesn\u2019t support nested objects. It also lacks transaction support, and you\u2019re probably going to need to sort out your own interface for that.<\/p>\n

Its popularity has been waning over the last few years and\u2014like Meteor\u2014a lot of that seems to just be because it feels old. <\/em>It\u2019s often seen as outdated and clumsy, and people are moving onto newer and shinier things.<\/p>\n

Next.js<\/strong><\/p>\n

Next is a weird one: it\u2019s a frontend Node framework, if that makes sense. To quote one of its contributors<\/a><\/strong>:<\/p>\n

\u201cnext.js is not supposed to replace your backend. Next is a client-side framework that happens to have a server-side component to allow features like HMR and SSR.\u201d <\/em><\/p>\n

It\u2019s not strictly in competition with the other frameworks (except sometimes Meteor) because it\u2019s occupying a totally different space. It\u2019s a framework for developing SPAs in React\/JavaScript, and it\u2019s very good at that job. Next is still relatively underutilised in the javascript community, but it seems to be building up steam: the developers working with it speak highly of it, and a lot of the community have expressed interest. If you\u2019re trying to put together a single-page app, it could be worth a look.<\/p>\n

Koa<\/strong><\/p>\n

Koa is a super tiny framework, designed and maintained by the same developers as Express. Unlike Express, it hasn\u2019t really taken off. It\u2019s so stripped down that it barely feels like a framework at all, that\u2019s its greatest strength and greatest weakness. It\u2019s lightweight, flexible, highly expressive middleware but it lacks the sort of NPM support that a framework needs to survive, especially a framework that is designed to have a small footprint\u2014if you can\u2019t rely on modules to fill the gaps, then you\u2019re going to struggle getting certain jobs done.<\/p>\n

If you\u2019re accustomed to operating outside of the NPM ecosystem and want a framework that\u2019s not going to get in the way, then Koa is a solid choice. Otherwise, its lack of community and support might cause problems.<\/p>\n

FeathersJS<\/strong><\/p>\n

Feathers is your go-to if you\u2019re building REST APIs. It\u2019s built around two pillars:<\/p>\n