Is it possible to create desktop applications with node.js? [duplicate]
Asked Answered
C

5

59

I've created an application using node.js, and I'm interested to know if it's possible to pack the client side (js, html ,css) and the server side into a standalone application (that doesn't required browser).

Capp answered 9/1, 2012 at 19:40 Comment(5)
I suppose you mean "using a conventional UI"? It's not designed for that, so I doubt that it would be highly useful for that. We use our frameworks for the things they are designed for. nodejs isn't even a language, tho, so remember that. It's just a framework to run a javascript app against a javascript VM.Bethanybethe
This appears to be part of a Duplicate Pool: #6146061, #7557864, https://mcmap.net/q/77051/-how-to-make-exe-files-from-a-node-js-app, #8794640, #9725317, #13388608Saving
A good list of tools is here: https://mcmap.net/q/77054/-packaging-a-node-js-web-application-as-a-normal-desktop-application-closedClinical
electron github.com/electron/electron is your choiceSkaw
Electron creates 4 heavy Windows processes using a total of 60 MB of memory just for an app that creates a window. The lighter frameworks appear to have been abandoned.Lindner
L
48

https://github.com/rogerwang/node-webkit is a project with the goal of running an instance of the webkit browser engine in the same process as nodejs. It allows you to directly use nodes API in the browser. It currently only works on linux works on Windows, Mac and Linux now.

Last answered 9/1, 2012 at 20:40 Comment(7)
This looks similar to appjs - although node-webkit allows you to use Javascript functions directly from the DOM, while appjs (apparently) requires both a server-side and a client-side.Astto
Also, do you have any instructions for installing node-webkit? I'm looking forward to learning it.Astto
It appears to now support Linux, Mac OSX and Windows.Isochronal
@Isochronal Thanks, amended that.Last
this is BIG this is in direct competition with Adobe AirCosmology
Is this how TileMill was built?Casserole
Can't compete Adobe Air yet, I don't see iOS or Android support.Footfall
E
15

I am also investigating this.

AppJS is looking very promising as an api for building cross platform desktop apps using HTML5, CSS3 and NodeJS. Unfortunately for me it's probably not well enough developed for my next project.

Extrovert answered 15/11, 2012 at 18:29 Comment(2)
+1 for a great find. The project looks good with several apps already developed.Fireguard
appjs is abandoned. They themselves are now recommending you use NW or Electron instead.Affluence
D
9

I have been investigating this very topic since the node-webkit project was announced.
I have a blog post about my early efforts http://csainty.blogspot.com/2012/01/creating-desktop-apps-with-nodejs.html

In the latest code drop you can now specify an application closedown callback, which makes it easy now to instantiate your applicaton and a localhost webserver when the application is started. Then close it all down cleanly when it is closed.

This make it pretty easy to port a web application to the desktop depending on what other server dependencies you might have.

var nwebkit = require('node-webkit'),
    http = require('http');

var server = http.createServer(function (req, res) {
    // If you need it you can create a local web server
    // You can also use express etc if preferred
    }).listen(3000, '127.0.0.1');

nwebkit.init({
    'url': 'index.html',
    'width': 800,
    'height': 600,
    'onclose': function() {
       server.close();
    }
});
Debate answered 16/1, 2012 at 7:35 Comment(1)
With nwjs no need to start web server to server webapp static assets. You can set "main": "app/index.html" in manifest.json, it can load the webapp from local files, and security restrictions will not apply, you can make ajax etc.Crusado
T
8

you can write a desktop app using Qt with node

see this binding

https://github.com/arturadib/node-qt

Torin answered 16/6, 2012 at 19:50 Comment(1)
Unfortunately looks like that nice project is not maintained too much anymore.Sarson
P
0

There have been some attempts, but at the moment there isn't a proper library for this:

http://www.readwriteweb.com/hack/2011/04/build-desktop-apps-with-nodejs.php
https://github.com/appcelerator-titans/nodejs-desktop-prototype

Prostate answered 9/1, 2012 at 20:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.