Should I choose Q or Bluebird as Promises library?

NAVIGATION

Turn to community

Review repository

Verdict - use Bluebird

Native Promises are part of ES6 specification and fully supported by Node.js from v0.12. However, the ES6 specification describes a brief representation of Promises that may leave some users wanting more. Dedicated Promise libraries extend the ES6 Promises specification with more functionality. Two prominent Promise libraries are Q and Bluebird.

"Which Promises library should I use: Q or Bluebird?"

Let's review both libraries and try to choose one over the other. Let's use the two-step process of first turning to the community and then reviewing the project repositories. This process is described in detail in separate articles in Part 1 and Part 2.

Turn to community

Let's first turn to the community. Various indicators exist that convey package reliability. They are not waterproof but are a good starting point. They range from the number of dependent projects to the number of downloads in the last month and from stars on GitHub to general health ranking sites.

Q Bluebird
Dependent projects 6 810 8 080
Dependent repositories 15 800 16 500
Downloads in the last month 6 753 948 7 177 345
Stars on GitHub 11 409 10 575
Package Quality (health ranking) 93,9 99,9
Comparison of reliability metrics for Q and Bluebird packages.

It looks like they are both pretty even. Bluebird seems to have a slight edge over dependent projects and the number of downloads. Stars on GitHub are both evenly in the 11k range. Bluebird has a slight edge on Package Quality.com health ranking.

Review repository

Next, let's look at the project repository for each project.

Clear instructions

Q - GitHub Readme.md, very clear and informative, a bit long Bluebird - dedicated website, some pages missing, nice looks, informative reads, thorough explanations

Reason for existence

Q - to solve the pyramid of doom, the infinite nesting callback problem Bluebird - performance is king, a fast implementation of Promises

One might ask if performance is a necessary concern when dealing with asynchronous operations. There is a dedicated page on the Bluebird site "Bluebird: Why Performance?" but it is not completed.

Is it maintained

Q - last release 11 months ago Bluebird - last release less than 24 hours ago

Is the scope clear

Both concentrate on the Promises problem space. They both have augmented the standard Promise functionality with various helpers that ease everyday operations and help to deal with complex workflows. Bluebird has support for coroutines.

Open issues

Q - fair amount of open issues, 86 out of 411 Bluebird - good rate of issues closed, only a few open: 14 out of 748

Can you read the code

Q - more readable of the two, but not as modular and mostly in a single file Bluebird - large codebase but modular, not the most readable code ever, performance optimization surely provide their own difficulties when trying to follow code

Not something you could fix yourself.

Verdict - use Bluebird

While the community indicators go even for both packages, Bluebird seems to be the better-maintained project. Both are very complex pieces of code and fixing any bugs you encounter are best left for the module authors. Due to this reason the maintenance activity proves to be a deciding factor.

Q seems to have slowed down on the releases front, and one might wonder if critical bugs will be updated promptly or not. Bluebird has some pages missing in the documentation, but otherwise very thorough explanations.

The verdict: use Bluebird.

Related articles

There are 350 000 NPM packages. Your task: pick one.

There are 350 000 NPM packages. Your task: pick one.

Learn what to look for in a reliable NPM package.

Get Guide

Loading Comments