Use node-webkit to create desktop applications

In this article, I will introduce the content of node-webkit by deploying and building packages for web applications on Mac and Windows.

Warning: This post is outdated and may not reflect the current state of the art

First, disclaimer: I will not discuss runningNode.jsCode, but only package web applications to run on Mac and Windows. Linux is also part of the game, but I did not introduce it.

Node WebkitThat's it, it is called from its creator Web runtime.

It is based on Chromium (despite the name) and node.js. It allows us to call node.js code and modules directly from the DOM, and opens up new possibilities for native applications written using web technology.

In this article, I just introduce it by deploying and building packages for web applications on Mac and Windows as if it were a native application.

Run the application

First, let us introduce the index.html file


We also need a package.json file

  "name": "My Web App",
  "main": "index.html"

That’s it from the code-side! Really.

Now to run the app, download the runtime from the site for your specific platform, and then you can call

$ alias nw="open -n -a node-webkit '/PATH_TO_APP_DIRECTORY/'
$ ./nw

cd /PATH_TO_APP_DIRECTORY/ zip -r app.nw ./

You have now created a package of the app. You can double-click it on Mac, or drag over the node-webkit application on Windows, and it will run.

There are a lot of options you can now add to the package.json file, but that’s a start. You can for example hide the top bar with address and debugger, set the menu items, and decide pretty much all you need.

Now, let’s dig into packaging and distributing an app.

Package the app on the Mac

Unzip the package downloaded from the node-webkit site.

Right-click, “Show package content”, go in Contents/Resources and copy there the app.nw file built with

$ zip -r app.nw ./

or alternatively, copy the app directory there and name it “app.nw”.

That’s it! You can now change the default icon and properties in the Contents/Info.plist file.

Package the app on Windows

Download the latest Windows package.

Copy the .nw file built using Zip in the package directory, alongside nw.exe, and call it app.nw

Run the command

copy /b nw.exe+app.nw app.exe

You can now remove the nw.exe & app.nw files, zip the directory and distribute the package. Your users will need to download the zip file, uncompress and then run the app.exe file contained.

More devtools tutorials: