Checklist for choosing an optimal npm package
Tags: npm, node, beginners, javascript
Published: 2019-08-22 20:39:37

---
title: Checklist for choosing an optimal npm package
published: true
description: There is no doubt, you have probably used npm in your project at least once. Npm helps us with finding, installing and updating various project dependencies and packages. There are few things to keep in mind while searching for an npm package and before installing the npm package.
tags: npm, node, beginners, javascript
cover_image: https://thepracticaldev.s3.amazonaws.com/i/s5c8esu3d7ppmotmb95l.jpg
---

There is no doubt, you have probably used npm in your project at least once. npm helps us with finding, installing and updating various project dependencies and packages. There are few things to keep in mind while searching for an npm package and before installing the npm package:

* Does the package have any vulnerabilities?
* Is the package being maintained?
* Does the package have bugs that will affect my use-case?
* Is the package size acceptable?
* How does it compare to similar packages?

##Does the package have any vulnerabilities?

As we’ve seen before, npm packages can become a target for various attacks and malicious code injections. Although `npm audit` and `npm audit --fix` does a good enough job of tracking and fixing vulnerabilities, you can use [snyk.io](https://snyk.io/) to search for the package in their vulnerabilities database before even installing the package.


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/cntv8w11zohppy2xp27n.png)

##Is the package being maintained?

Simplest way of checking if the package is being actively maintained by the author or the community is to simply go through the version history and see how often the package is being updated. It’s also good to check the issues section on the github and see if author is actively working on fixing bugs reported by the users.

##Does the package have bugs that will affect my use-case?

Similarly to the previous item, you can check the issues section on github and see if there are any active issues or bug reports that apply for your use case. Few examples of these issues are: conflict with another package, edge-case issue, specific performance issue, etc.

##Is the package size acceptable?

Sometimes, a package can have dependencies that increase the package size dramatically and which, in turn, will affect our website/app size and performance. In order to avoid this, you will want to check the bundle size on
[Bundlephobia](https://bundlephobia.com/) and see if this fits your size and performance requirements.


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/th3cdm44oyygudrmccxw.png)


##How does it compare to similar packages?

Often times, you might find multiple packages that fit your requirements. In those cases, you would want to compare them side-by-side and determine which package truly fits your needs, is regularly maintained and is widely used.

One of those tools is [npm compare](https://npmcompare.com/). It shows a highly-detailed side-by-side comparison of two packages and it highlights which package is the best in each metric (issues reported, average time for updating, size, etc.).

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/favubotmsu95j9jsv70r.png)

Another useful tool is npm trends [npm trends](https://www.npmtrends.com)  which shows package popularity over time and simple, less-detailed comparison.


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/c12n0wchk4fqhlp8emp1.png)

## Anything else to be aware of?
Feel free to post in the comments if you take into account some other criteria when searching and selecting an npm package.

{% devcomment ee7n %}


<hr />

These articles are fueled by coffee. So if you enjoy my work and found it useful, consider buying me a coffee! I would really appreciate it.

<a href="https://www.buymeacoffee.com/ubnZ8GgDJ" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-red.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>

Thank you for taking the time to read this post. If you've found this useful, please give it a ❤️ or 🦄, share and comment.