Over a million developers have joined DZone.

10 Areas Where Tooling Makes Node.js Developers More Productive, Part 1

In this blog series, we will go over the most important categories of tools that are closely related to all aspects of successful nodestering.

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Maybe you are a Node.js developer, JavaScript community veteran, passionate supporter, or generally into modern software development. Or perhaps you want to learn how to be more productive with various tools that successful Node.js professionals are using. Either way, you’ve come to the right place. 

In this blog series, we will go over the most important categories of tools that are closely related to all aspects of successful nodestering—from development environments, frameworks, and test and build tools to continuous integration, delivery, and monitoring. So, without further ado, let’s start our journey through the world of Node.js tools.

Disclaimer:  You will probably notice that the tools showcased are a bit pro-backend or DevOps-oriented. I apologize for that, but keep in mind that many of the tools and their applications go beyond just backend/frontend/desktop/mobile: Their purpose is to build good quality software in general.

1) IDEs

What is a developer without a good integrated development environment (IDE)? The answer is simple: Unproductive. A good IDE will not let you leave its windows, menus, shortcuts, etc. ever (except to take a look at the browser). Code completion, support for various tools, plugins, debuggers, good performance, and good themes are simply the prerequisites for a good IDE, whether it’s free or a paid product. 

Since Node.js development on Windows is no longer that uncommon, .NET developers-turned-nodesters will appreciate Visual Studio or any of the many general (cross-platform) editors like Sublime Text, Atom, Brackets, Visual Studio Code, or even NetBeans. They all have the basics right and are good tools. Give them a try.

But there is one that has it all and much more: Webstorm. It’s a well-done commercial IDE with support for most modern frameworks, build tools, and a load of plugins to make your work easier and more enjoyable. It is a de facto JavaScript cross-platform powerhouse for developing everything from backend services to intricate web apps.

Image title

Some of the most interesting features for Node.js developers might be the ability to easily do memory heap analyses and CPU profiling with visual representation via flame charts. Read more about it here.

2) Build Tools

As with any other software project, you need to have some tools to help you build your app/service/project, prepare it for a release (or release for a specific environment like the load environment), or simply run test suites. The Node.js (and JavaScript) ecosystem is rich with tools to jump in. Some of them like GulpGruntBrunch, or WebPack are so well-known and rooted that they are featured in some IDEs and you don’t need to be a command line ninja to use them. They allow you the flexibility to write code and make your life much easier.

Image title

Grunt declares itself a JavaScript runner, but it's really a powerhouse that allows you to do a lot with little code—especially if you are using some of the plugins from its rich plugin ecosystem.

Image title

Gulp touts itself as an easy-to-learn and easy-to-use streaming build system and is very popular for its flexibility. It aligns really well with Node.js streams and their ability to pipe.

In general, there is a lot of overlap in terms of satisfying developer needs for both of these, but for a more generalized understanding, we can say that Gulp is more focused on writing code and Grunt on writing configurations. It's up to you to evaluate your needs and try to find a good fit for your projects.

Another approach to builds and automation in the Node.js world is using npm-scripts. This is due to its simplicity (remember the KISS principle?) and tight integration with Node’s faithful counterpart, the famous node package manager (npm). Simply add them to your package.json file and run via npm run <script_name>. In addition, it provides hooks and you can run local modules you might have so you don’t need to install them globally.

3) Transpilation

If you need or want to write your code in a superset of JavaScript and use something like TypeScript, CoffeeScript, or Spider, or if you just want to have the latest ES2015 or ES.next features at your fingertips, you must have heard of transpilation. Transpilation is the process of compiling your code, via a transpiler, into code that can run safely, in this case, in a Node.js environment and also in the modern browser (like the newer Chrome and Firefox browsers and IE10+). Node.js does not run CoffeeScript code out of the box. It runs JavaScript, and the transpiler does the conversion of CoffeeScript to JavaScript. Transpilation from a newer version of JavaScript to an older one is a common practice, too (e.g. you write your code in ES6 and transpile it to ES5 so it can safely run in browsers or under Node.js), and it gives you tomorrow’s features of the language today. 

The king of transpiration in the Node.js world for JavaScript-to-JavaScript transpilation is a tool called Babel.

#!/usr/bin/env bash
# install babel cli and preset
npm install --save-dev babel-cli babel-preset-es2015

# do the transpiling of original.js file to transpiled.js
babel original.js --out-file=transpiled.js
// small example
let tests= ['one', '2', 'III'];
const test = () => console.log(...tests);
'use strict';

var tests = ['one', '2', 'III'];
var test = function test() {
  var _console;

  return (_console = console).log.apply(_console, tests);

But it is not the only one. Check out Bublé or Traceur.

4) REST API Frameworks and Services

If you are using Node.js to build REST API  services (microservices, anyone?) and haven't opted out for a more esoteric framework, then you are left with a few well-known and battle-tested frameworks. Those are Restify, HAPI and Express.js.

Express.js is probably the most widespread and well-known framework that is used for all sorts of web (app) development, including API development. Not so long ago, it was considered too bloated for API development, but in its last incarnation (version 4) this is no longer the case. It has been seriously re-architected to be light, and all the niceties you may remember from previous versions that were available almost out of the box are now available as separate modules that you plug in and use depending on your needs (as anything else in Node's module ecosystem).

Restify is a popular choice for rest APIs. It is a very straightforward framework with API development in mind only. It has some features that set it apart from others like out-of-the-box support for DTrace and built-in REST Clients for easy and fast consumption of other services (very useful if you are building an API gateway microservices component).

HAPI is another great framework that focuses on simplicity and performance, but it is not as widespread as the previous ones and might lack in ecosystem richness and widespread production maturity. Definitvely worth consideration when building an API with performance in mind.

StrongLoop Loopback is another open-source framework that could help you out in this area. It's a more comprehensive toolset that generates a lot of the code for you (models, database migrations) and can get you very far in a short time. But as with any bigger framework, you delegate your sense of security and knowledge in code and risk a possible lock-in that might be costly in the end. Surely this is a good contender, as it is backed by IT giants like IBM, and the tooling being developed for and around it is and will be more and more impressive and maybe even enterprise-production grade.

To test your REST API services, you will need a good REST client. If you like Curl, fine, knock yourself out, but for those of us who like something more intuitive, visual, and full of savings/categorizing/sharing features, Postman is a perfect tool.

5) Test Frameworks and Tools

Node.js, being powered by JavaScript, a weakly typed language, makes automated testing an even more important and time-consuming part of software development. Enter Mocha and Chai. Mocha is a flexible testing framework (an enabler of test suites, so to speak) that is usable in a browser or Node.js and is very widespread in combination with Chai, an assertion library. This combination is mostly used in backend development testing and, with a set of their plugins, can be used to fulfill the needs of almost any type of tests (unit, integration, functional, smoke).

#!/usr/bin/env bash
# make soure you have mocha installed
npm i mocha -g

# run tests with mocha

mocha --reporter=spec test.spec.js
var chai = require('chai');

var expect = chai.expect;
var assert = chai.assert;

var testObj = {
  name: "test",
  sub: {
    name: 'test sub'
  numbers: [1, 2, 3, 4],
  hasNumbers : true

describe ('Test Suite', function () {
  describe('expect tests', function () {
    it ('should be a valid testObject', function () {
      expect(testObj.sub).to.have.property('name').that.is.a('string').and.to.equal('test sub');
      expect(testObj).to.have.property('numbers').that.deep.equals([1, 2, 3, 4]);
      expect(testObj).to.have.property('hasNumbers', true);


  describe('assert tests', function () {
    it ('should be a valid testObject', function () {
      assert.propertyVal(testObj, 'name', 'test');
      assert.property(testObj, 'sub');
      assert.propertyVal(testObj.sub, 'name', 'test sub');
      assert.property(testObj, 'sub');
      assert.deepEqual(testObj.numbers, [1, 2, 3, 4]);
      assert.typeOf(testObj.hasNumbers, 'boolean');


On the frontend side, it is more common to see a combination of Karma.js and Jasmine. Karma.js is a test runner that is framework agnostic and allows you to test and simulate in real browser environments using a headless PhantomJs instance. Jasmine is a framework for testing JavaScript code and provides the ability to define tests and performs expectation checks in a behavior-driven development style (much like Chai’s BDD flavor).

For a more comprehensive example of how to install, configure, and use Jasmine and Karma, take a look at this AngularJS testing article.

It's good to know that the JUnit "standard" of describing test results (XML file) is very accepted, tool-rich, and widespread so these test tools gravitate to or have strong support (via plugins or modules) to give you that desirable JUnit output with little effort.

Was This List Useful?

Stay tuned for more recommendations for Node.js developers in Part 2.

Related Refcard:

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

api development ,node.js ,rest ,javascript

Published at DZone with permission of Mihovil Rister, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}