The difference between Node.js require, and Wordpress plugins or Drupal modules

Date: Thu Jun 15 2017 Node.JS »»»» Node Web Development »»»» Wordpress »»»» Drupal
nodejs-dark.pngSomeone experienced with using Wordpress, or Drupal, to build websites are accustomed to "plugins" or "modules". Both are software modules which extend the functionality of Wordpress or Drupal websites, giving more features to the system than what's available out of the box. For example it's typical for a Drupal site to install Views to support building fancy data displays, and on my Wordpress blog I've added the PODS Framework to simplify defining custom post types along with custom fields.

In Node.js the require statement brings in additional software, and adds more capability, so yes it's similar to a plugin or module for CMS's like Wordpress or Drupal. However, there are plenty of differences especially because Node.js is not a CMS, so therefore Node.js packages are at a different level of granularity.

Click here for more Node.js programming advice

Node.js is a general purpose software development platform akin to Python. It's built around the JavaScript language and specifically the V8 engine that's at the core of the Chrome web browser. In essence, Node.js free's JavaScript from being trapped inside web browsers, and lets us use JavaScript in server environments.

You can write any kind of program using Node.js, including (but not limited to) content management systems.

This means a Node.js package author has different needs/concerns than a Wordpress plugin, or Drupal module, author. The latter two are concerned with tweaking the CMS's features and therefore hook into API's exposed by the CMS to add functionality. With Node.js, since it is a general purpose programming platform, package authors have a much broader set of goals.

For example, the Grunt or Gulp tools (each are written in Node.js) are build tools widely used to build not just Node.js projects, but all kinds of web projects. Grunt and Gulp are themselves Node.js packages, and then the capability of both products are extendable by other Node.js packages.

Similarly the static website generator I wrote - AkashaCMS - is implemented as a Node.js package, and its features can be extended by plugins that are themselves Node.js packages. Since it is also a content management system, the realm of likely AkashaCMS plugins is similar to the realm of likely Wordpress plugins or Drupal modules.

What I'm getting at is there is no typical Node.js package and the purpose of Node.js packages is not restricted by being in the context of a content management system. In other words, Node.js packages could serve pretty much any purpose, as is evidenced by browsing the NPM package repository.