Top 10 lesser-known useful NPM packages
By: Akash Saggu
Tags: NPM, JavaScript, Nodejs, Tutorial, Top 10

Long ago, software engineers realized they could significantly speed up the development process by eliminating the need to write repetitive code in every application over and over again.

Node.js applications benefit from more than a million open-source packages available in the NPM package registry. Most popular packages get well over 10 million weekly downloads and are at the foundation of many applications, from small pet projects to well-known tech startups. Today, 97 percent of code in modern web applications comes from npm modules.

We’ll briefly cover the lesser-known useful ones that will save you from reinventing the wheel.

1. quick-validate

Quick configurable API validations for Express.js

Features:

- Simple — Provides a simple and quick way to configure API validations.

- Clean — Unlike other libraries, quick-validate does not require you to write a lot of code for adding simple validations. It uses simple JSON configuration files which do not pollute application code.

- Readable — The validations are much more readable and comprehensible.

Check documentation for customization, options, and usage.

2. mquery

mquery is a fluent mongodb query builder designed to run in multiple environments.

Features:

- fluent query builder api

- custom base query support

- MongoDB 2.4 geoJSON support

- method + option combinations validation

- node.js driver compatibility

- environment detection

- debug support

- separated collection implementations for maximum flexibility

Example:

Check documentation for customization, options, and usage.

#3 Luxon

Luxon is a library for working with dates and times in JavaScript.

Luxon makes a major break in API conventions. Part of Moment’s charm is that you just call moment() on basically anything and you get date, whereas Luxon forces you to decide that you want to call fromISO or whatever. The upshot of all that is that Luxon feels like a different library; that’s why it’s not Moment 3.0.

Example:

Check documentation for customization, options, and usage.

#4 Helmet

Helmet helps you secure your Express apps by setting various HTTP headers. It’s not a silver bullet, but it can help!

Usage:

Check documentation for customization, options, and usage.

#5 cors

CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.

you can enable cors for all requests or for a single route

Check documentation for customization, options, and usage.

#6 colors

Get color and style in your node.js console

Example:

Check documentation for customization, options, and usage.

#7 got

Human-friendly and powerful HTTP request library for Node.js

Highlights:

-Promise API

-Stream API

-Pagination API

-HTTP2 support

-Request cancelation

-Follows redirects

-Retries on failure

-Progress events

-Handles gzip/deflate/brotli

-Timeout handling

-Errors with metadata

-JSON mode

-Hooks

-Instances with custom defaults

Check documentation for customization, options, and usage.

#8 express-brute

A brute-force protection middleware for express routes that rate-limits incoming requests, increasing the delay with each request in a fibonacci-like sequence.

Example:

Check documentation for customization, options, and usage.

#9 xss

Sanitize untrusted HTML (to prevent XSS) with a configuration specified by a Whitelist.

Example:

Check documentation for customization, options, and usage.

#10 express-mongo-sanitize

Express 4.x middleware which sanitizes user-supplied data to prevent MongoDB Operator Injection.

Usage:

Check documentation for customization, options, and usage.

Final Words:

This was our list of the top lesser-known NPM packages that coders and web developers can give a shot.

Before summarizing, we must tell you that don’t go by the popularity of the NPM packages. Instead, go by your personal requirements.

So, what are your thoughts on this list? Let us know in the comment section below.