Packaging a Node.js web application as a normal desktop application [closed]

I've searched a bit, but I can't find an existing tool for this.

I have a Node.js web server that is designed to run on your own computer that does some snazzy things for you. It would be pretty awesome if I could double click MySnazzyThing.app instead of installing Node.js, and npm and running node mysnazzyapp.js on the command line.

The .app executable would spool up the Node.js server and open a simple native WebKit window which would show what would normally be on localhost:3000 if I were running on the command line.

This native application could then, say, be distributed through the Mac App Store. And bam, a Node.js desktop application.

Does any such tool exist? Or are there any technical reasons that this wouldn't work as I imagine it?


Solution 1:

Option 1: Electron (formerly atom-shell)

This is the shell that GitHub's Atom and Microsoft's Code editors use. It’s very similar to node-webkit, though it will run the script first, and you have to create a view/window for the user. There are some other minor differences, but it's worth looking at.


Option 2: NW.js formerly node-webkit

The gist is that it basically extends the JavaScript engine for you to write a web-based application supporting Node.js' extended object model, and modules... you then package your package.json start.html modules and JavaScript files into a ZIP file (with the .nw extension) and run it with nw(.exe) .. there are Windows, Mac and Linux builds available.


Option 3: Neutralinojs Github

Neutralinojs is a lightweight and portable desktop application development framework. It lets you develop lightweight cross-platform desktop applications using JavaScript, HTML and CSS. You can extend Neutralinojs with any programming language (via extensions IPC) and use Neutralinojs as a part of any source file (via child processes IPC).


Option 4: MacGapNode (OS X only)

MacGap with Node.js integration (it seems to be getting stale)


Option 5: Tauri Github

Tauri is a toolkit that helps developers make applications for the major desktop platforms - using virtually any frontend framework in existence. The core is built with Rust and the CLI leverages Node.js making Tauri a genuinely polyglot approach to creating and maintaining great apps.


Aside: Services...

I can't speak for OS X on this as a .App, but it could well be possible to create a background service install in Node.js and a link to a "local" site on the desktop. Most browsers have an option to not show all the features (I know Firefox in particular does).

I know your question is to OS X in particular, but in Windows you can use NSSM to run anything as a service, and I have used it for Node.js-based services in Windows. I think some of the other options above are better depending on your needs though.


Removed:

  • nexe - stale/unmaintained
  • AppJS - replaced with DeskShell
  • DeskShell - stale, website offline
  • node-webkit - renamed to NW.js
  • XULRunner project stalled, and exceedingly behind.
  • Thrust (Node Adapter) - deprecated/stale
  • Carlo Chrom(ium) shell from Node.js. - unmaintained/stale

This answer is copied for multiple questions, and these references are mostly for updating convenience.

  • Packaging a Node.js web application as a normal desktop application
  • Package a Node.js application as an OS X application

Solution 2:

You can accomplish this using AppJS.

Solution 3:

I suggest looking into Topcube. Its goal is to give Node.js developers a way to have a desktop GUI to their Node.js servers using HTML5 + CSS 3 as the GUI platform.

Topcube at GitHub.