Log Management and Analytics

Explore the full capabilities of Log Management and Analytics powered by SolarWinds Loggly

View Product Info

FEATURES

Infrastructure Monitoring Powered by SolarWinds AppOptics

Instant visibility into servers, virtual hosts, and containerized environments

View Infrastructure Monitoring Info

Application Performance Monitoring Powered by SolarWinds AppOptics

Comprehensive, full-stack visibility, and troubleshooting

View Application Performance Monitoring Info

Digital Experience Monitoring Powered by SolarWinds Pingdom

Make your websites faster and more reliable with easy-to-use web performance and digital experience monitoring

View Digital Experience Monitoring Info

Blog Technology

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

By Mihovil Rister 08 Jun 2016

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.

webstorm

 

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 Gulp, Grunt, Brunch, 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.

grunt

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.

gulp

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 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.

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 as 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 so widespread as the previous ones and thus may be lacking in ecosystem richness and widespread production maturity. Definitvely worth a 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 in code and knowledge of it and thus risk a possible lock-in that may 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 it 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).

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 a 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.

The Loggly and SolarWinds trademarks, service marks, and logos are the exclusive property of SolarWinds Worldwide, LLC or its affiliates. All other trademarks are the property of their respective owners.
Mihovil Rister

Mihovil Rister