Using NW.js to create a Desktop App

By

Scratch the surface of NW.js (formerly node-webkit): download the runtime, write a manifest, and package a web app as a desktop app for Mac and Windows.

~~~

First, a disclaimer: I’m not going to cover running Node.js code, but just packaging a web app to run on Mac and Windows. Linux is also part of the game, but I’m not covering it.

NW.js is, that’s how it’s called from its creators, a web runtime. I wrote this post when the project was still called node-webkit. The name changed in 2015, after Chromium replaced WebKit with its own Blink engine and the old name stopped making sense.

It’s based on Chromium and Node.js. It lets us call Node.js code and modules directly from the DOM, and opens new possibilities for native applications written using Web technologies.

The official site is nwjs.io, the source lives at github.com/nwjs/nw.js and you download builds from dl.nwjs.io. As of September 2026 the current release is v0.116, built on Chromium 153. NW.js ships a new version every few weeks to follow Chromium. There are two flavors: the SDK build includes DevTools, so use that one while developing, and the normal build is the smaller one you ship.

In this post I’m just scratching the surface of it, by deploying and building a package for a web application, on Mac and Windows, just like it’s a native application.

Run the app

First, let’s introduce the index.html file:

<html>
  <body>
    <p>test</p>
  </body>
</html>

We also need a package.json file:

{
  "name": "my-web-app",
  "main": "index.html"
}

main is the page NW.js opens at startup, name identifies the app. That’s it from the code side! Really.

Now to run the app, download the NW.js runtime for your platform and pass it the folder that contains package.json. On the Mac the binary is inside the .app bundle:

cd /PATH_TO_APP_DIRECTORY/
/PATH_TO/nwjs.app/Contents/MacOS/nwjs .

On Windows you run nw.exe . from the app folder, or drag the folder onto nw.exe.

If you’d rather not download anything by hand, the nw package on npm downloads the runtime for you. Run npm install --save-dev nw in the app folder, then npx nw . starts the app.

You can also zip the whole app folder into a single file:

zip -r app.nw .

That’s the package we’ll use to distribute the app below.

There are a lot of options you can now add to the package.json file, see the NW.js Manifest format, but that’s a start. You can for example hide the top bar, set the window size, 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 nwjs.app package you downloaded.

Right-click > Show Package Contents > Contents/Resources, then put your app.nw zip there (or copy the app directory 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 Windows package of the same NW.js version.

Put app.nw next to nw.exe, then run this command to merge the two into a single executable:

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

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

For the details, like replacing the icon of nw.exe or renaming the Mac bundle, check the NW.js packaging docs.

Tagged: DevTools · All topics

Want me to talk about your product? You can sponsor this site.

~~~

Related posts about devtool: