Search code examples
javascriptnode.jstilemill

What does Tilemill use to make node.js into a native desktop app?


https://github.com/mapbox/tilemill

I've been trying to figure out how tilemill packages their node application into a desktop application for mac, linux or windows. I've searched their github project and I do not see anything that gives any specifics about how they did this.


Solution

  • They are starting a mini-server on ports 20008 & 20009 using an included nodejs & libs, and then opening it in a webview. Each target platform has basic wrapper that controls node process, and opens a webview pointing to localhost:20009

    For example, on Mac, everything (nodejs & libraries & assets) is included in TileMill.app/Resources/ then under TileMill.app/MacOS/ is TileMill which just loads node + index.js (in Resources/) and opens webview.

    A simpler cross-platform way to accomplish something similar is to use node-webkit. Not only do you get easy deployment, but you can call nodejs directly inside the web-layer, instead of having a bunch of web callbacks. This means that you can do things like access files directly, and don't need to keep your client/server separate.