ready to build your product

The Most Trending Node.js Open Source Projects – Deep Study

Lots of things have happened in the JS world. As it’s coming to an end, I’ve been wondering if I missed out on any hot trends and projects this year. If you share my curiosity and would like to check if your impressions and predictions correspond with the actual global community trends, let’s take this journey together.

The quest: What do we want to find out?

So what I myself wanted to find out in particular, before entering 2020, is what the most trending Node.js open source projects were.

By open source projects I mean public GitHub repositories, as open source projects are mainly hosted on GitHub, and even if a given project is primarily hosted somewhere else like BitBucket, GitLab or SourceForge, it can have a mirror on GitHub.

By the most trending I mean those whose popularity (number of downloads, number of contributions) has grown the most.

Research assumptions

The main measures of popularity I considered are:

  • GitHub stars,
  • GitHub used by,
  • NPM downloads,
  • Google searches.

There are some problems with these measures – I haven’t found a way to find the past number of GitHub used by and NPM downloads. The number of Google searches isn’t the best measure either as in the software world, people usually search directly on GitHub or NPM without using Google. Therefore, I decided that the most accurate way to measure popularity is by GitHub stars.

When I say “Node.js open source projects” I mean the following:

  • libraries which can be used in Node.js (and which are used mainly on backend or equally on backend and frontend because e.g. React can be used on the backend for server side rendering, but I wanted to focus on libraries which are more backend specific),
  • Node.js frameworks,
  • tools which can be used in Node.js,
  • Node.js server applications (nanoservices, microservices or monoliths),
  • fullstack applications (frontend can be either web, mobile or desktop) which use Node.js on server side,
  • some collection of Node.js good practices/links.

Abbreviations used in this article:

  • lang – programming language
  • JS – JavaScript
  • TS – TypeScript
  • CI – Continuous Integration
  • DBMS – Database Management System

During my research I found plenty of Node.js open source projects that I’ve never heard about that I think are interesting, and I hope you’ll think so too.

P.S. To take full advantage of this article you’re going to need at least basic knowledge of Node.js, GitHub, open source, NPM, JavaScript, TypeScript, GraphQL, SQL and REST.

The research method

So how did I conduct my research? Well, I found a tool to retrieve the previous number of stars for a given GitHub repository (it’s accessible at star-history.t9t.io).

Sadly, it has some limitations:

  • You cannot check the exact star number for a selected date e.g. January 1, 2019.
  • It doesn’t show star number if it’s above 39,960. That’s because the GitHub API (stargazers endpoint) returns 422 status for pages above 1,333 and the maximum number of stargazers in a single page is 30.
  • For the points showing star number for some dates, we cannot be sure whether this number was exactly equal to the shown number at that date because unstarring a repo causes GitHub API to remove the user from the stargazers.

To work around the first problem I implemented my own library (available here). Unfortunately, I didn’t manage to overcome the second and the third problem.

Then, I implemented a script to find the most trending Node.js open source projects (available here). I used GitHub API again, this time to find the repos matching a given key phrase and written either in JavaScript or in TypeScript. There are other languages compiled to JS and thus are possible to use with Node.js, such as CoffeeScript, Dart or Elm, but they are much less popular and some of them like CoffeeScript are failing.

I decided to use the following categories/key phrases to find trending Node.js open source projects, as I think they reflect Node.js and general backend characteristics:

  • audio
  • cache
  • database
  • docker
  • event
  • file
  • framework
  • graphql
  • image
  • library
  • lint
  • logging
  • mail
  • Node.js
  • number
  • odm
  • orm
  • queue
  • sort
  • string
  • template
  • test
  • time
  • typescript
  • validation
  • websocket

Results

For each of the categories mentioned earlier I found 30 repos with the highest number of stars, checked their star number on January 1, 2019, and calculated the difference and the quotient based on the current and the past star number.

I sorted the repos by star difference and the star quotient. Then I manually removed the repos unrelated to Node.js and those with description written in languages other than English. If repo was a purely frontend app or a full stack app with backend in a technology other than Node.js, I removed it, but if it included Node.js backend, I kept it.

Moreover, I removed libraries which exceeded 39,990 stars more than one year ago because I’m not able to count their number of stars at the beginning of this year and this article’s goal is to present repos which were not widely known one year ago. Of course, it’s possible I made a mistake in some manual actions.

I decided to group the repos into the following categories:

  • database
  • event
  • library
  • logging
  • mail
  • Node.js
  • queue
  • validation

Database

Repos by star difference:


Repos by star quotient:


As you can see, hasura/graphql-engine is the highest in both ranks. As GraphQL popularity has been growing for the last few years, it’s no wonder this repo is one of the most trending Node.js open source projects.

Second place in both ranks belongs to typeorm/typeorm. It has a very descriptive README and supports plenty of DBMS. Its community has a chat and an average percentage of uncommented open issues (408 out of 1191, so 34%). It works not only in Node.js but also Browser, Ionic, Cordova and Electron apps.

Two other interesting packages are typicode/lowdb and agershun/alasql as both of them support both Node.js and browser, however they are used in quite different ways: the former supports JS methods, while the latter supports SQL.

Event

Repos by star difference:


Repos by star quotient:


The first place in both ranks is occupied by hasura/graphql-engine – the same library which won in the Database category.

The 2nd place by star quotient and the 4th place by star difference belongs to primus/eventemitter3. I think the main reason for its fast growth is replacing its predecessor EventEmitter2/EventEmitter2.

The 2nd place by star difference and the 4th place by star quotient is occupied by node-red/node-red, which may be useful for low-level programming.

The 3rd place in both ranks belongs to developit/mitt. Its main advantage is a very short code. I checked it and found that it uses Flow and JSDocs plus some amount of tests. After leaving only production code, building it into pure JS code and minifying, the code in the installed package stays very short.

Library

Repos by star difference:


Repos by star quotient:


This category is very wide, but I decided to include it in my research in order to avoid neglecting some trending libraries which might not fit into any other category.

The 1st place in both ranks belongs to iamkun/dayjs, which may be a replacement for another popular library moment/moment. At first glance, I can say Day.js has a better README than Moment.js. Another advantage is higher test coverage – 100% vs 88% – though I’m a bit sceptical when I see 100% coverage because it only means that all the paths are covered but not necessarily with all the important scenarios, including edge cases. In fact, it’s always possible to write another valuable test but at some point we stop adding them – it’s when the value of a new test is smaller than its cost (implementation time, tests refactor, updates).

The 2nd place by star quotient and the 6th place by star difference belongs to hapijs/joi. This library has a very short README, which redirects to a very precise docs with plenty of examples. Personally, I have a lot of experience with using Joi in microservice endpoints validation in the Koa framework, and I can really recommend this library. Though I used it in Koa, it was written for Hapi.js framework, and it’s possible to use it standalone without any framework as well. The main advantage is having a very clear validation code. When I miss Joi capabilities, instead of writing an ugly validation inside the endpoint handler, I often write a Joi plugin that I can easily use.

Moving on – the 2nd place by star difference and the 6th place by star quotient is occupied by lodash/lodash. My own observation across my JS development career is that its usage is pretty stable among the existing Node.js developers and maybe it’s even falling a bit. This growing trend by GitHub stars may be visible due to the fact that Lodash is one of the most popular JS libraries. Whenever new people start learning JS, they start using Lodash and star the repo. I personally really like this library because it very often provides a one-line solution to what vanilla JS would need several lines of code to accomplish.

The 3rd place by star quotient and the 5th place by star difference belongs to lovell/sharp. This library facilitates image processing in a simple way. I like its interface using Promise and method chaining. I use it in one of microservices and noticed that it sometimes generates problems on install, mainly because it compiles low-level code. In most cases (I’d say 99%), a simple yarn install or npm install  does the job but sometimes it fails and I need to run a reinstall.

The 3rd place by star difference and the 4th place by star quotient is occupied by date-fns/date-fns, which is another date utility library. I personally prefer Moment.js and wish people contributed to this repo instead of creating new ones.

Logging

Repos by star difference:


Repos by star quotient:


The 1st place by star quotient and the 2nd place by star difference belongs to gajus/slonik. It’s a PostgreSQL client, so unfortunately it doesn’t support plenty of DBMS. Another disadvantage is that its build is currently failing. An advantage is a descriptive README with a table of contents. I think the main reason for its growing popularity is that although it was started in 2017, it became mature enough to use it, very recently.

The 1st place by star difference is occupied by visionmedia/debug. One of its advantages is working both in Node.js and browses. It’s used by 5.5 million GitHub repos, so counting indirect dependencies, it’s one of the most popular NPM packages.

I think it’s also worth mentioning paypal/gnomon (3rd place by star quotient). This example of Node.js open source projects is a simple and useful tool, working in terminal. What’s missing a CI to run tests and publish to NPM because without that I don’t know whether the tests are passing and whether the newest code is published. Moreover, a linter (which should be also run in CI) is also missing to perform static code analysis. It’s unbelievable its popularity is growing so fast though the last commit was pushed in 2016. I hope that thanks to growing popularity, somebody will find time to fix the open issues (each one reported either in 2017 or 2018).

Mail

Repos by star difference:


Repos by star quotient:


The 1st place by star difference belongs to nodemailer/nodemailer. A great advantage of this Node.js open source library is that it has 900 closed issues and only 4 open issues. It uses an SMTP host, but I prefer using a third-party server like Sendgrid or Sparkpost because of a simpler configuration and the option to send a very large number of emails.

The 1st place by star quotient and the 2nd place by star difference is occupied by forwardemail/free-email-forwarding, which is another tool for a custom mailing server.

An interesting project is freeCodeCamp/mail-for-good (4th place by star difference). It’s a non-profit application for sending email campaigns. It contains both frontend and Node.js backend using packages such as express, passport, helmet, aws-sdk, bluebird and socket.io.

Node.js

Repos by star difference:


Repos by star quotient:


The 1st place by star quotient and the 2nd place by star difference belongs to nestjs/nest. This Node.js open source is a framework implemented in TypeScript for Node.js scalable backend. It’s very actively maintained – at the moment of writing this blog post, it had many commits pushed in the few hours before. It has great support for issues and PRs: 75 open issues vs 2,021 closed issues, which means only 3.6% of all the issues are still open; 34 open PRs vs 1,364 merged or closed PRs, which means only 2.4% of all the PRs are still open. The issues and PRs are labeled, which makes filtering them much easier.

The 1st place by star difference and the 3rd place by star quotient is occupied by goldbergyoni/nodebestpractices. It’s a great set of good Node.js practices, which IMO every Node.js developer should read. Of course, you can contribute too! The number of open PRs is 6 and the number of merged or closed PRs is 431, which means only 1.4% of all the PRs is still open.

The 2nd place by star quotient and the 3rd place by star difference belongs to strapi/strapi, which is a Node.js CMS. I can’t say much about Node.js CMS from personal experience because I write applications not web pages, but looking at this trend, maybe Strapi is the best Node.js CMS.

Queue

Repos by star difference:


Repos by star quotient:


Generally, I recommend using RabbitMQ (rabbitmq/rabbitmq-server) for queuing because it’s the industry standard. However, it has some disadvantages – there’s a limit of scheduled time about one month, so we need to do a workaround in order to schedule an action to be done after 12 months. Another potential disadvantage is that it’s implemented in Erlang, which isn’t a popular language so contributing to RabbitMQ might not be so easy.

The 1st place by star quotient and the 4th place by star difference belongs to animir/node-rate-limiter-flexible. Its key advantage seems to be supporting plenty of DBMS. According to what they tell in benchmarks, this library has a higher performance than its alternatives. Unfortunately, its latest build is failing.

The 1st place by star difference and the 4th place by star quotient is occupied by OptimalBits/bull. The key advantage of this Node.js open source library is having the most features. As they compare in their README:

Discover the most trending Node.js open source projects in 2019.

The 2nd place by star difference belongs to agenda/agenda. It’s based on MongoDB and their advantage above Bull is providing REST API. I’ve been using Agenda for more than one year and it seems to be stable.

Validation

Repos by star difference:


Repos by star quotient:


The 1st place by star quotient belongs to typestack/class-validator. It might be a good solution for TypeScript projects because the validation is based on a TypeScript class, using annotations. There are some extensions of this library as well.

The 1st place by star difference and the 2nd place by star quotient is occupied by jquense/yup. Its usage is similar to Joi, however it might be easier to write custom validation in Yup.

In this category we also see some Node.js open source projects mentioned in the previous categories such as moment/moment and hapijs/joi.

Other libraries which look interesting to me are validatorjs/validator.js, which is specialized in String validation, providing plenty of validating functions, and epoberezkin/ajv, which validates data by schema written in JSON Schema format, and they claim it’s the fastest JSON Schema validator.

Conclusion – which Node.js open source project is the best?

Sometimes we can say that one library or application is better than another one but mostly in cases when the second one has plenty of serious problems such as major bugs, extremely poor performance, missing documentation, not using semantic versioning, missing tests or no longer being supported while the first one doesn’t have any of these problems.

However, in other situations, in some aspects, the first one is better while in other aspects, the second one is better. Therefore, you must select products which fit your needs the most. Sometimes the decision is objective, like valuing the performance but another time it’s subjective e.g. when the team prefers method chaining or annotations.

I hope you’ve found some interesting Node.js open source projects to try or actively contribute to in this post. If so, please don’t hesitate to share the article with your colleagues and help them discover new, valuable tools!