Updated on Oct 4, 2023

We know what Node.js is and the two types of environments it has. Now, let’s take a look at some of its modules, also known as libraries and packages, and discuss what they are and what they can do for you.

The easiest way to describe what a module is would be to compare it to a car part. In the same way that a car part performs a specific function, a Node.js module is a JavaScript file that offers the application they are added to simple or complex functionalities. And, much like a car part, these files can be reused across multiple applications and multiple systems. If you are familiar with WordPress and its plugins, then that is another comparison you can think of.

Unlike WordPress plugins, for instance, a module is actually self-contained to a degree. We mean that it will not cause conflicts with other modules or the core Node.js files. WordPress plugins can cause a plethora of issues if they cause a conflict with any other plugins or the core files, but a module will not. 

There are three types of Node.js modules. They each perform different functions and serve different purposes, so we will mention them quickly just to give you an idea of what they are and can do.

  • Core Modules - These are the modules that all Node.js applications come with. These lightweight modules form the basic functionalities of Node.js and are loaded automatically when the environment is installed. Some of those modules are: http, url, querystring, path, and util;
  • Local Modules - As the name suggests, a local module is created on your current application. In other words, it is a module that you, yourself, have created. Many of the popular third-party modules were created this way, then packaged and made available to the Node.js community;
  • Third-party Modules - These local modules have made their way online. They are available for download or via the Node Package Manager (NPM). We will discuss NPM in the next section of our tutorial. These modules typically provide additional functionalities to your application. Connecting to a database, for example.

The existence of such modules makes developing with Node.js much easier since some very popular functions can be downloaded instead of coded from scratch.

On this page...

    Node.js Hosting

    • Multiple Node Versions
    • 24/7 Node.js Support
    • Free Domain Transfer
    • Hack-free Protection
    • Fast SSD Storage
    • Free Node.js Transfer
    • Free Cloudflare CDN
    • Immediate Activation
    View More