
If you want to create your own desktop application based on web technologies, the world of open source offers two main options: NW.js (formerly known as node-webkit) and Electron (atom-shell). The choice between them is not so obvious, so I decided to create a comparative table and dwell on the most important differences.
Both NW.js and Electron provide a platform for developing desktop applications with HTML as a presentation and NodeJS for accessing the system API (for working with hard disks, hardware, etc.). But there are fundamental differences between the two projects.
')
Paradigm
In NW.js, the entry point to the application is a web page. You specify the URL of the main page in package.json and it opens as the main application window. In Electron, the entry point is a NodeJS program. Instead of specifying the URL directly, you “manually” create the window and load the HTML file into it using the API.
This is an oversimplification, but it can be said that the NW.js paradigm is more browser-oriented. NW.js loads the specified HTML page and this page accesses the Node.js context. If more than one window is open, they all get access to this general Node.js context. This means that you can get transparent access to the DOM of all open windows.
Electron, on the other hand, has a more NodeJS-oriented approach. It launches the Node.js runtime environment, which gets the ability to open windows into which you can then load web pages. This means that connecting multiple windows to the main process is much more difficult.
Winner : Depends on your needs.
Source Code Protection
Electron does not have any mechanism to protect your source code.
Asar can hardly be called acceptable protection, given that this is a simple tar archive and virtually any user can “unpack” your program as a regular archive and get access to all resources and source code.
NW.js allows you to collect the executable file with protection through the
V8 Snapshot . This solution, of course, does not compile JavaScript into native code (according to the documentation) and does not ensure complete security of the source code. In fact, this is just a very well obfuscated code. But if the only alternative is to leave the source code completely open, then many developers will prefer the V8 Snapshot, even considering the loss of about 30% performance.
Winner : NW.js
Start time
I did not specifically try to measure the launch time of the application, but according to my personal feelings, the application on the Electron runs much faster on both Windows and OSX. Even if you disable the V8 Snapshot, the NW.js application loads much slower.
Winner : Electron
Open source
At the time, Electron took a bold step, supporting IO.js at the time of Node.js stagnation. This means that Electron is heavily committed to maintaining the advanced features of JavaScript, while NW.js is more focused on backward compatibility (at least in theory).
Also it is impossible not to notice the high speed development of Electron. More than a hundred commits a week, ten releases a month. The development team is actively answering questions on github. On the other hand, NW.js is still in version 0.15, and github documentation seems rather outdated. For example, you can regularly see the mention of the name "node-webkit", although the project was renamed several years ago.
Winner : Electron
Achievement list
Despite the fact that NW.js exists longer than Electron, as far as I can tell, Electron has developed many more popular applications. From
this list of NW.js, besides Popcorn Time and Koala, it is difficult to isolate anything significant. On the other hand,
the Electron list looks much more solid:
- Atom
- Slack
- Visual Studio Code
- Cocos Creator
- Pixate Pixate
Winner : Electron
Conclusion

By and large, the only significant difference between the two projects is reduced to one feature - the ability (or lack thereof) to “secure” your source code. In my opinion, this is the only reason why a developer can choose NW.js. Although this conclusion probably suffers from my own bias, because I used Electron much more actively than NW.js. Therefore, in the comments, please tell about your experience with these two libraries.
see alsoNW.js & Electron ComparedTechnical Differences Between Electron and NW.js