DEV Community

Christophe El-Khoury
Christophe El-Khoury

Posted on

NodeJS Frameworks - The Whats and the Whys

I've been assigned a task to find the best NodeJS Framework for our API microservice.
The internet is full, overly-saturated if I may, with articles telling you what the top 10 NodeJS frameworks are. Needless to say, I've seen the words Express and Sails in 2 hours more than I've seen my Girlfriend's name IM'ing me in a week.

Every time I read an article it says MVC-framework, FullStack-framework, RESTful-framework and quite frankly I can't figure out what the hell is going on!

So, for the NodeJS gurus out there, can someone please write an article about how to pick the right NodeJS Framework? Depicting what the types of frameworks are, and why we need to use each type?

Thanks.

Top comments (1)

Collapse
 
kbariotis profile image
Kostas Bariotis • Edited

I've been writing Node.js for the past 6 years and never used a "framework" as in Laravel for PHP. Something like that probably exists out there but I've never used one neither I've been in a team where they used one. I believe that the JS community decided that we want to have many things for every job so we can decide on each one individually and how to plug them together (NPM registry currently holds ~1m packages which makes it by far the biggest registry of all).

So what I would do in your position. I would write down all features and capabilities I want the new service to provide. Based on that then I would pick individual packages.

Here's an example:

  • HTTP server/router: Express, Koi
  • SQL ORM: Sequelize
  • NoSQL ODM: Mongoose
  • Dependency injection: awilix, inversify
  • Types: Flow, Typescript
  • Test runner: Mocha, Ava
  • API Documentation/Generator: Swagger, RAML
  • Linter/Formatter: ESLint, Prettier

After I pick some, I would start digging into how to glow them together. You could probably find some boilerplates to get you started. Here's my favorite one.

Whether you want to go down that path though or if you still need to find the one framework, that list would still be helpful, because now you know exactly what features you are looking for. Remember to be conscious of the packages/framework you are picking. They must be battle-tested, at some degree active, have code coverage, doing frequent releases. Most importantly, they are somewhat aligned with your goals. You don't want your API framework of choice to suddenly start talking about implementing GraphQL as a feature.

So, for the NodeJS gurus out there, can someone please write an article about how to pick the right NodeJS Framework? Depicting what the types of frameworks are, and why we need to use each type?

I would love to hear more about what exactly confuses you. Can you elaborate on that please and maybe on what you would like that article to talk about?

Hope I was helpful. I would love to hear from other people if they are using any framework and which one. Good luck with your task! 😄