5 Essential NPM Packages You Must Know

Node packages you need every day

Every scalable project should meet some criteria. So I am going to describe the best practices.

Playing with time and array is mandatory in every system.

A system without a logger is a headache, and it is almost impossible to maintain if there any error occurs.

We also need middleware and one last thing is automated test.

Every point I mentioned is mandatory for large/small systems. Sometimes we do it from scratch, but I think this is a waste of time. Some npm packages have great support with these features, and it is reliablestable and easy to use.

1. Moment — Time manipulation

I think handling time management (timezone, date, month, format, etc.)is the most common and hassle in a system. The Moment is one of the most stable & maintained time manipulation library. The whole collection of libraries, created to solve the issues of formatting, parsing, converting, and, generally, working with different forms of time, Moment.js is the one that has seen the widest adoption. Here is the reference.

2. Winston — logger tool

For reporting, the system should have a logger and winston is better for this. Winston is very powerful and easy to use. Logger helps to debug from the previous report. Store log file as JSON is standard, and I think this is helpful because JSON is more flexible to go through the script for finding the desired report. Just go to the link and have a look.

3. Loadash

The most popular and widely used library for playing with array loadash is popular. A huge number of projects and library depends on it.

Lodash makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc. Lodash’s modular methods are great for:

  • Iterating arrays, objects, & strings
  • Manipulating & testing values
  • Creating composite functions

4. Mocha

Mocha is the most powerful testing tool in node.js widely used for tests. It makes asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting while mapping uncaught exceptions to the correct test cases. Just pass your input and desired value and it will return you the result.


5. Morgan

Morgan is the most popular HTTP request logger middleware for node.js.

Morgan functions take 3 arguments tokenreq, and res, where a token is an object with all defined tokens, req is the HTTP request, and res is the response. The function is expected to return a string that will be the log lineundefined, or null to skip logging.


Obviously, you need all of these in your day-to-day life if you are a programmer, and having these concepts can help you to release your pain.

Have a great day!

Leave a Reply

Your email address will not be published. Required fields are marked *