Category Archives: Tutorials

Node Toolchain for Newbies: The Best Node Apps and Libraries to Increase Productivity

Node Toolchain for Newbies: The Best Node Apps and Libraries to Increase Productivity

I get this question very often: “What tools would you recommend for Node development?” Software engineers love to optimize and increase productivity instead of wasting their time. I bet you are one of them! Read on to find out the best Node tools for development.

  • IDEs/code editors
  • Libraries
  • GUI tools
  • CLI tools

IDEs/code editors

When it comes to your primary tool, the code editor, I recommend sticking with lighter and simpler editors like Atom or VS Code instead of full-blown IDEs like Webstorm. Of course an IDE will do more for you but this comes with a learning curve and the need to configure. Node is interpreted, thus there’s no need to compile it. The files are just plain text files with the .js extension.


Here’s my list of the best Node editors:

  • Atom: created and maintained by GitHub; uses Electron, HTML, JS and CSS under the hood which makes it very easy to customize or add functionality; allows to have Git and terminal support via packages. Price: free.
  • VS Code: a newer addition; uses similar to Atom web-based tech; was created from Azure’s Monaco editor; comes with debugging, smart autocomplete based on types, Git and terminal support. Price: free.
  • WebStorm: more of an IDE than an editor, developed by JetBrains and based on IntelliJ platform; has code assistance, debugging, testing, Git. Price: starts at $59/yr for individuals.

There are more options like Brackets, Sublime Text 3 and of course IDEs like Eclipse, Aptana Studio, NetBeans, Komodo IDE, and cloud-based like Cloud 9, Codenvy.

What to pick? Any of the three in the list is good choice. I have heard good things about VS Code and their smart autocomplete is a nice thing, but I didn’t find it a good enough reason for me to switch from Atom. So try VS Code and Atom and see which one you like more. Both of them offer a wide variety of packages and themes.

The most popular and useful libraries and project dependencies

Here’s the list of the most used and most popular modules which you would install as dependencies of your projects. Node developers use most of these modules (or alternatives) in almost all of their projects.

The libraries are listed with the npm names, so you can execute npm i {name} substituting {name} with the name of the package/module:

  • webpack: Builds static assets like browser JavaScript, CSS and even images. It allows to use node modules in the browser.
  • babel: Allows to code in the latest versions of JavaScript/ECMAScript without having to worry about your runtime by converting the new code to the code compatible with older versions of ECMAScript
  • axios: Makes HTTP requests
  • express: the most popular Node web framework
  • mongoose: MongoDB object-document mapper library
  • sequelize: PostgreSQL object-relational mapper library
  • Real-time library with support of Web Sockets and others.
  • cheerio: jQuery syntax for working with HTML-like data on the server
  • node-oauth: Low-level but very mature and tested library to roll out any OAuth integration
  • passport: OAuth library to quickly integrate with major services
  • yargs
  • shelljs
  • mocha: Testing framework
  • async: Controls flow by running function concurrently, sequentially or any way you want
  • concurrently: Allows to execute CLI tools (local) as multiple processes all at the same time, e.g., webpack and node-static.

Note: Some of the libraries/tools listed above like webpack or mocha, can be installed globally instead of locally in your project folder. However, installing them globally is an old practice and currently is an anti-pattern because local installation allows developers to use multiple versions of the tool with different projects in addition to have these tools specified in package.json.


Of course there are a lot of different options in each category. For example, request and superagent are also extremely popular HTTP agent libraries. However, I don’t want to give too many options and confuse you with the differences, I listed only one tool (typically the one I use the most currently).

CLI tools (global)

pm2 in action
pm2 in action

Unlike the previous section, these tools are okay to install globally since most likely their version won’t affect or break your project.

  • node-dev: Monitor and restart your Node app automatically on any file change within the current folder
  • node-static: Serve files over HTTP web server
  • node-inspector: Debug Node code in a familiar interface of DevTools (now part of Node starting with v7)
  • docker: Build and run Docker containers to isolate app environment, speed up deployment and eliminate conflicts between dev and prod (or any other) environments
  • curl: Make HTTP(S) requests to test your web apps (default for POSIX but can get for Windows too)
  • nvm: Change Node versions without having to install and re-install them each time
  • wintersmith: Build static website using Node templates and Markdown
  • pm2: Process manager to vertically scale Node processes and ensure fail-tolerance and 0-time reload

GUI tools

MongoUI in action
MongoUI in action

A good share of Node developers prefer GUI (graphical user interface) tools at least for some of the tasks because these tools require less typing and have features which makes them more productive and the development easier and simpler.

  • Postman: HTTP client with ability to save requests and history, change formats (JSON, form, etc.) and do other things
  • MongoUI: Modify and inspect your MongoDB data in a web interface. You can host this web app on your server to enable the database management.
  • Chrome: DevTools is a great way to inspect your requests, network, traffic, CPU profiles and other developer related data which is very useful for debugging
  • iTerm, itermocil and zsh: A better alternative to a native macOS Terminal app which together with itermocil and zsh increases productivity greatly
  • SourceTree: Visual git trees and histories

If you liked this post, next step is to understand the Node platform better. For this reason, check out this FREE course You Don’t Know Node.

ES 7 and ES8 Features

Recently I wrote a blog post and even created an online course on ES6/ES2015. Guess what? TC39—the mighty overseer of JavaScript—is moving forward with ES8 so let’s cover ES7 and ES8 (or ES2016 and ES2017 officially). Luckily, they are much, much, much smaller than the best of a standard that was ES6. Really! ES7 has only two (2) features!

ES7 features:

  1. Array.prototype.includes
  2. Exponentiation Operator

ES8 is not finalized yet as of this writing (Jan, 2017) but we can assume all finished proposals (stage 4) and most of stage 3 (more on stages here and in my course). The finished 2017 (ES8) proposals are:

  1. Object.values/Object.entries
  2. String padding
  3. Object.getOwnPropertyDescriptors
  4. Trailing commas in function parameter lists and calls
  5. Async Functions

I won’t include stage 3 proposals in this post, but you can check the status of proposals from stage 1 to 3 here.

Let’s dive deeper into the proposals and features…

The rest of the article:

How Node Event Loop REALLY Works: Or Why Most of the Event Loop Diagrams are WRONG

When Bert presented his keynote at Node Interactive Europe 2016 on Event Loop, he started by saying that most of event loops diagrams are WRONG. I’m guilty of using one of them in my talks. :)

This is it. In it, event loop is spinning data back at clients like hot-cakes.

His diagram is closer to the real stuff. In it, event loop starts, works and then quits eventually (pun intended).

Continue reading

Node.js in Containers Using Docker

Node.js in Containers Using Docker

Container technology is one of the best options for software development and deployment. It allows you to share some of the OS resources while encapsulating the code and other concerns. You can think of containers as virtual machines but with less footprint.

Containers are great for micro services where you replace monoliths with many services. Each of them works in isolation and communicates with other services via a well defined interface (typically REST).

Docker is one of the most popular implementations of containers. Docker’s What is Docker? page has a a neat comparison of containers with VMs. In a nutshell, VMs use hypervisor and each VM has it’s own OS while containers share OS and only separate libraries, bin, executables, etc.

Continue reading

Autocomplete Widget with React

This project will guide you through building an autocomplete function similar to the one that you might see in Slack (a popular messaging app), as shown in figure 1, when you type something in the search box. For simplicity, our widget will work with room names (the rooms in a chat application).

Figure 1
Figure 1

The autocomplete widget will have (figure 2):

  1. An input field
  2. A list of options filtered according to the entered characters
  3. An Add button (figure 3)
Figure 2
Figure 2

The filtering of the matches will be done using the entered characters as the first characters of the option. In other words, there is a simple comparison that allows us to autocomplete the name of the room (figure X). For example, if you type “mac” and you have “Mac OS X” and “Apple Mac,” then only “Mac OS X” will be shown as a match, not both options.

Continue reading

React Native Quickly: Start Learning Native iOS Development with JavaScript NOW!

React Native Quickly: Start Learning Native iOS Development with JavaScript

This book is a guide on getting started with React Native for mobile iOS development. You can find source code and the manuscript in You can read this book online here, or at, or if you prefer videos, you can watch project videos at Node.University:

In this book, I’ll introduce you to React Native for native mobile iOS and Android development… and do it quickly. We’ll cover topics such as

  • Why React Native is Awesome
  • Setting up React Native Development for iOS
  • Hello World and the React Native CLI
  • Styles and Flexbox
  • Main React Native UI components
  • Importing Modules into an Xcode Project
  • Project: Timer
  • Project: Weather App

This book is about getting started with React quickly and not about React Native, which is technically a separate library (or some might even call it a framework). But I figured after eight chapters of working with React for web development, it would be fun to apply our knowledge to mobile development by leveraging this awesome library. You’ll be amazed how many React Native skills you already know from React.

Continue reading

Learn HTTP/2 Server Push by Building Express Middleware

Learn HTTP/2 Server Push by Building Express Middleware

In the previous post, we learned how to perform HTTP/2 server push in a Node server. We also covered the benefits of server push there so to avoid duplication we won’t list them here. We used spdy for server push and H2. But most of the times Node developers don’t work with core HTTP server, they use a framework like Express. So let’s see how we can implement server push in Express.

Continue reading

Optimize Your App with HTTP/2 Server Push Using Node and Express

Optimize Your App with HTTP/2 Server Push Using Node and Express

HTTP/2 is the new standard of the web. It has many great features which will make the web faster and simplify the development. For example, no need to concatenate files thanks to multiplexing, or a server push which can send files before a browser knows it need them.

This post won’t cover all advantages of HTTP/2. You can read about them online. No need to go into all the details and duplicate text here. Instead, we’ll focus on server push and implement it in Node.js using Express and the spdy library.

Continue reading

Easy HTTP/2 Server with Node.js and Express.js

Easy HTTP/2 Server with Node.js

The modern Internet with its TCP/IP protocol started around 1975 which is astonishing 41 years ago. For the most part of its existence, we used HTTP and it’s successor HTTP/1.1 (version 1.1) to communicate between clients and servers. It served the web well but the way developers build websites has dramatically changed. There are myriads of external resources, images, CSS files, JavaScript assets. The number of resources is only increasing.

HTTP2 is the first major upgrade to the good old HTTP protocol in over 15 years (first HTTP is circa 1991)! It is optimized for modern websites. The performance is better without complicated hacks like domain sharding (having multiple domains) or file concatenation (having one large file instead of many small ones).

Continue reading

JSON is Not Cool Anymore: Implementing Protocol Buffers in Node.js

JSON is Not Cool Anymore: Implementing Protocol Buffers in Node.js

There’s a better alternative to the ubiquitous JSON as the communication protocol of the web. It’s Protocol Buffers (protobuf). In a nutshell, protobuf offers a more dense format (faster processing) and provides data schemas (enforcement of structure and better compatibility with old code).

Protocol Buffers were introduced by Google. You can read, more about them at the official Protocol Buffers Developer Guide. For something shorter, read 5 Reasons to Use Protocol Buffers Instead of JSON For Your Next Service which will give you a quick overview of the protobuf benefits over JSON.

The purpose of this article is not to highlight why protobufs are better or sell you on the concept. There are many article online that’ll do it for you. The purpose of this article is to show you how you can get started with this format in the Node.js environment.

Continue reading