I’ve joked for over a year now that if there ever was a HTML 6 its marquee feature would be Node.js. In other words I should be able to write a packaged app that sits on a device that has one part running in a browser/webview and another part running a local Node.js instance that I can use to accept incoming request. Furthermore I need to be able to build and deploy HTML 6 packaged apps on at least (but not at most) - Android, iOS, Linux, OS/X, Windows desktop and Windows RT. The purpose of this article is to lay out my nefarious plan for making HTML 6 packaged apps real.
This article contains my opinions, not my employers. You have been warned.
2 Groking the model or It’s the Web, Stupid!
3 So what exists today?
Below are the efforts I know of today that seem relevant to making HTML 6 packaged apps real. If I missed something, please let me know!
Cordova In terms of packaged HTML 5 apps for mobile platforms Cordova seems to be a pretty big deal. But it doesn’t (currently) support Node.js and it doesn’t have a desktop story.
node-webkit This effort marries Chromium and Node.js to create a single run time environment that generates self contained apps, but only for the desktop. Their model makes the UX and node.js code much more tightly coupled than I am looking for. And there’s no mobile story I know of. But it’s still pretty cool. I need to grab some time to seriously play with it.
jxcore This is a fork of Node. Amongst other things they allow folks to write node apps and then package them for all the desktop environments but they have also said they will support iOS, Android and WinRT. Their desktop work is in beta and their mobile work is in alpha. They are closed source right now but have claimed that they will go open source before their final release.
tidesdk/TideKit tidesdk was an open source effort to create a single development environment for HTML5 packaged apps that would run on all the usual desktop OS’s. TideKit is apparently the replacement and is closed source in a closed beta. It claims to support writing packaged HTML 5 apps for, well, everything, e.g. both mobile and desktops. They do talk about Node.js but I believe they mean integrating with it when it’s running server side. But I could be wrong.
node.js They support all the desktop OS’s today and have put in support for Android (but see here for instructions to make it actually work). I’m not aware of any plans on their part to support iOS or WinRT. And the node folks aren’t directly worried (at least not that I’m aware of) about packaging themselves up into apps. But the Android work strongly implies that something is probably going to have to give there. We shall see.
neu.node This is an older, possibly no longer relevant, effort to create a Node like environment for iOS. It was started before Apple loosened their restrictions on interpreted code in iOS applications.
Chrome Packaged Apps This is an effort by Google to deliver HTML 5 packaged apps everywhere including all the usual desktop OSs as well as (via Cordova and Crosswalk on Android) for mobile OS’s. For obvious reasons Chrome Apps focuses on making it easy to use Google’s cloud infrastructure and it doesn’t seem to have any kind of service model ala Node.js.
4 How I’d like to see things happen
In talking with folks I think it’s easier if I make my own biases clear. I can and do change my mind but at least by understanding where my thinking is starting hopefully those kind enough to spend time talking to me will find it easier to navigate me away from my delusions.
It seems to me that the ideal outcome would be:
Cordova adopts the desktop as a compilation target.
- I’d be happy to see this just be a wrapper around node-webkit but abstract away how node apps are started since it’s a non-goal to provide the level of integration node-webkit provides between the UX and Node environments. And yes I did see the project to combine node-webkit and Cordova but it seems moribund. Still, it could be a great place to start.
- Alternatively I’d be happy to just have us create a native app that opens up the user’s default browser and simultaneously starts a node.js instance in the background.
Node.js runs on iOS and WinRT (it’s already on Android)
- From a compatibility perspective the ideal solution here would be for Node.js to directly support iOS and WinRT which would mean getting V8 to run on those platforms. There is some hope for iOS. WinRT is a harder nut to crack, but I’ll have to see what can be done. The main issue, btw, is that WinRT doesn’t allow 3rd party code JITing.
- A substantially less attractive option is to create node ’like’ alternatives for those platforms. That is essentially what neu.node and nodeapp are doing. They are not Node but they try to be faithful to the Node APIs. This inevitably creates compatibility issues and in practice largely means that native add-ons are a no-go since those are very specific to V8. So native V8 support is certainly the desired direction.
Provide application life cycle hooks for both the HTML 5 front end and for Node.js on all supported platforms
- Cordova already has a model for this, we would need to also expose it to Node.js.
Create a Node.js Cordova plugin
- A developer would create their Cordova app as usual and include a Cordova plugin that can call out to a node app. We’ll have to plug into the Cordova build process and based on the target platform we would then run NPM, compile any native add-ons for the target platform and then package node, source files, etc. together.