Today, we’ll be going over the six biggest Node frameworks: their strengths, their weaknesses, and when it’s the right time to use them.
Yep, still the champ, and with good reason. Express is a simple, lightweight framework that has—in JS terms—stood 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’t look to be slowing down any time soon.
On the other hand, it’s a bit of a blunt instrument. It often results in awkward, buggy code and lays down landmines for future developers. It’s a perfectly respectable framework for most jobs, but it can struggle with specialist work.
That said, it’s not going anywhere. Express is to JS what Bootstrap is to CSS or Google is to search engines—it’s not always the best choice, but it’s usually the best choice and that’s more than enough.
Meteor’s popularity has declined with each passing year, and I’m not sure it’s going to stick around for much longer. I’d be strung up if I didn’t include it, but it feels like a bit of a dinosaur, getting constantly outmaneuvered by newer, more streamlined frameworks.
It’s still a very powerful framework, with power 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’s a full-stack package. It hasn’t entirely been obsoleted because there’s 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.
Meteor is big, solid, heavy and inflexible. If it’s the right fit then it’s a perfect fit, but it doesn’t have the maneuverability or versatility of Express.
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 a broader range of noSQL databases. Sails also has a great team and great documentation, though I haven’t 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.
One downside is that Waterline doesn’t support nested objects. It also lacks transaction support, and you’re probably going to need to sort out your own interface for that.
Its popularity has been waning over the last few years and—like Meteor—a lot of that seems to just be because it feels old. It’s often seen as outdated and clumsy, and people are moving onto newer and shinier things.
Next is a weird one: it’s a frontend Node framework, if that makes sense. To quote one of its contributors:
“next.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.”
Koa is a super tiny framework, designed and maintained by the same developers as Express. Unlike Express, it hasn’t really taken off. It’s so stripped down that it barely feels like a framework at all, that’s its greatest strength and greatest weakness. It’s 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—if you can’t rely on modules to fill the gaps, then you’re going to struggle getting certain jobs done.
If you’re accustomed to operating outside of the NPM ecosystem and want a framework that’s not going to get in the way, then Koa is a solid choice. Otherwise, its lack of community and support might cause problems.
Feathers is your go-to if you’re building REST APIs. It’s built around two pillars:
- Services are JS objects that implement core methods. Say a user wants to set up an account, you want a service using Object.create(). But should users be able to set up that simply? That leads us to:
- Hooks are ways of modifying services. You can customize your user account creation with hooks like validation emails, while still using the same service.
I can’t really speak to its utility outside of the API space, but I’ve found it handy there. I’m not sure I’d use it for anything else, though I’m curious to hear any reports from developers who are using it more broadly.
In 2019, Express.js is still dominating JS backend and I imagine that—short of a massive failed overhaul a la Angular—it’s going to stick around for a while. Meteor seems to be on the way out, though it lacks any proper competition in the fullstack Node space and I think it’s going to hang on until something better comes along. Sails and Koa are also on the way out, though in both cases it seems more like a failure to launch—they were never that big to begin with, and they’ve slowly bled developers over the last few years.