Introduction
To solve a development task, it’s better to take a step by step approach. That’s why developers create and use packages. In this article series called “Useful NPM packages for Node.js” we will periodically publish a collection of NPM packages that will give us the functionality of working with web services, time, configuration files, encryption, standardization and many more. So let’s get started.
Prerequisites
You should be familiar with JavaScript to get the most out of this article. You should also be comfortable with using the command line on your particular platform.
To install and use npm packages you need Node.js, download Node.js from the official site. If you’re running a Linux system, you can also install Node.js through your terminal, like this.
⌜ dotenv ⌝
Installation (npm) :
Usage:
⌜ config ⌝
Config organizes hierarchical configurations for your app deployments. It lets you define a set of default parameters, and extend them for different deployment environments (development, test, production, etc.). Configurations are stored in configuration files within your application, and can be overridden and extended by environment variables, command line parameters, or external sources. This gives your application a consistent configuration interface.
Installation (npm) :
Usage:
⌜ nodemon ⌝
Nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.
Installation (npm) :
Usage:
⌜ winston ⌝
Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file.
Installation (npm) :
Usage:
⌜ uuid ⌝
Create random UUID-s. Supports RFC4122 version 1, 3, 4, and 5 UUID.
Installation (npm) :
Usage:
⌜ dayjs ⌝
Day.js is a minimalist JavaScript library that parses, validates, manipulates, and displays dates and times for modern browsers with a largely Moment.js-compatible API. If you use Moment.js, you already know how to use Day.js.
Installation (npm) :
Usage:
⌜ bcrypt ⌝
A library to help you hash passwords.
Installation (npm) :
Usage:
⌜ node-cron ⌝
The node-cron module is tiny task scheduler in pure JavaScript for node.js based on GNU crontab. This module allows you to schedule task in node.js using full crontab syntax.
Installation (npm) :
Usage:
⌜ jsonwebtoken ⌝
An implementation of JSON Web Tokens. JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties.
Installation (npm) :
Usage:
⌜ express ⌝
Fast, unopinionated, minimalist web framework for node. Robust routing. Focus on high performance. Super-high test coverage. HTTP helpers (redirection, caching, etc). View system supporting 14+ template engines. Content negotiation. Executable for generating applications quickly.
Installation (npm) :
Usage:
⌜ passport ⌝
Passport’s sole purpose is to authenticate requests, which it does through an extensible set of plugins known as strategies. Passport does not mount routes or assume any particular database schema, which maximizes flexibility and allows application-level decisions to be made by the developer. The API is simple: you provide Passport a request to authenticate, and Passport provides hooks for controlling what occurs when authentication succeeds or fails.
Passport uses the concept of strategies to authenticate requests. Strategies can range from verifying username and password credentials, delegated authentication using OAuth (for example, via Facebook or Twitter), or federated authentication using OpenID. Before authenticating requests, the strategy (or strategies) used by an application must be configured.
Installation (npm) :
Usage:
Testing:
⌜ json-server ⌝
Get a full fake REST API with zero coding. Created for front-end developers who need a quick back-end for prototyping and mocking.
Installation (npm) :
Usage:
⌜ swagger-ui-express ⌝
Installation (npm) :
Usage:
⌜ helmet⌝
Helmet helps you secure your Express apps by setting various HTTP headers. It’s not a silver bullet, but it can help!
Installation (npm) :
Usage:
⌜ express-handlebars⌝
A Handlebars view engine for Express which doesn’t suck.
Installation (npm) :
Usage:
⌜ React CLI⌝
React is a JavaScript library for building user interfaces. Create React apps with no build configuration.
Installation and Usage (npm) :
⌜ Vue CLI⌝
The Progressive JavaScript Framework. Standard Tooling for Vue.js Development.
Installation (npm) :
Usage:
⌜ Angular CLI ⌝
The modern web developer’s platform. The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications directly from a command shell.
Installation (npm) :
Usage:
⌜ PM2 ⌝
ADVANCED, PRODUCTION PROCESS MANAGER FOR NODE.JS. PM2 is a daemon process manager that will help you manage and keep your application online 24/7
Installation (npm) :
Usage :
Conclusion
The packages we explored, can be used as an starting point for your next project. If you are considering learning how to use Node.js NPM packages, you should start by learning the Node.js language first. This will give a significant competitive advantage in the job market. Looking forward to next packages collection article. Thank you for reading!