Book Image

NW.js Essentials

By : Alessandro Benoit, Roger Weng
Book Image

NW.js Essentials

By: Alessandro Benoit, Roger Weng

Overview of this book

Table of Contents (17 chapters)
NW.js Essentials
About the Author
About the Reviewers


NW.js is a web app runtime, based on Node.js and the Chromium open source browser project, which enables web developers to build native-like desktop applications for Windows, Mac OS X, or Linux, leveraging all the power of well-known web technologies such as Node.js, HTML5, and CSS.

In NW.js Essentials, you'll be guided through the full development process, starting from the theoretical basis behind NW.js technology to the realization of a fully working, multiplatform desktop application.

What this book covers

Chapter 1, Meet NW.js, provides a presentation of the NW.js technology followed by a brief digression on how NW.js works under the hood, an analysis of the strengths of the library, and eventually a step-by-step tutorial on building a first, simple "Hello World" application.

Chapter 2, NW.js Native UI APIs, takes you through a thorough description of Native UI APIs with examples on how to interact with OS windows, work with menus, run shell commands, and much, much more.

Chapter 3, Leveraging the Power of Node.js, gives an introduction of how NW.js development differs from standard server/client programming and a few interesting hints on how to get the maximum out of Node.js within NW.js applications.

Chapter 4, Data Persistence Solutions and Other Browser Web APIs, explains more about data handling and takes advantage of Browser Web APIs to build beautiful, usable, and native-like desktop applications.

Chapter 5, Let's Put It All Together, builds a fully working application based on many of the concepts you've learned in the previous chapters.

Chapter 6, Packaging Your Application for Distribution, gives a step-by-step tutorial on the packaging process of NW.js applications on Microsoft Windows, Mac OS X, and Linux.

Chapter 7, Automated Packaging Tools, takes advantage of third-party tools to simplify the packaging process of NW.js applications.

Chapter 8, Let's Debug Your Application, teaches you different ways to debug your application and a few common issues of NW.js.

Chapter 9, Taking Your Application to the Next Level, involves a collection of ideas and resources to get the best out of what you've learned in this book.

What you need for this book

In order to fully understand the concepts explained in the book, a decent knowledge of the following subjects is mandatory:

  • Node.js programming and working with Node.js modules

  • Modern web application languages such as HTML5, CSS3, and JavaScript

  • Being comfortable with the use of the Unix terminal and the Microsoft Windows command line

It's not mandatory, but it might be helpful to have previous experience in the use of JavaScript task runners such as Gulp and Grunt.

Who this book is for

The book is targeted at experienced Node.js developers with a basic understanding of frontend web development.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Packages for Mac and Windows are zipped, while those for Linux are in the tar.gz format."

A block of code is set as follows:

  "name": "nw-hello-world",
  "main": "index.html",
  "dependencies": {
    "markdown": "0.5.x"

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

var markdown = require("markdown").markdown,
    div = document.createElement("div"),
    content = "#Hello World!\n" +
    "We are using **io.js** " + 
    "version *" + process.version + "*";

div.innerHTML = markdown.toHTML(content);

Any command-line input or output is written as follows:

$ cd nwjs
$ ./nw

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: " Open it, and from the top menu, navigate to Tools | Build System | New Build System."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.