My current App (WPF in Visual Studio) weighs 2MB.
And now I want to re-create this App with Node and Javascript.
Why? Primary reason is - I want to learn some Javascript (yes, this is My way to learning and please dont give me advices how to learn JS). Secondary reason - I want to use full power of CSS3, while WPF App supports only CSS2.
The problem is Weight. Any example App builded with Electron or NWJS weighs about 115MB!!!
I can understand that Desktop App require Node and Browser to work, but 115MB?!
So my question is - Is there any way to create Lightweight Desktop App with Electron/NWJS (or similar alternative)?
I can accept final weight about 50-60MB.
Electron or NW.js are huge in terms of size and required memory, but there are lightweight alternatives: Libui-node and Positron. Other lightweight platforms not based on node.js are: React-Native, XULRunner and Qt Quick with QML.
I can only speak for Electron, but 115MB sounds about right for a minimal app, the Chromium content library which Electron is based on is an all or nothing sort of thing and takes up a large chunk of that space.
Related
There are a lot of questions on this topic, but they don't seem to distinguish between executables for desktop or server-side apps. I suppose my first question would be: what's the difference? For example, Zeit/pkg says they are a "node.js binary compiler", whereas nwjs (formerly node-webkit) says they are a "an app runtime based on Chromium and node.js".
I tried zeit/pkg and it works great, but have read that there can be performance issues unless it's configured properly. I wanted to make sure I was choosing the right tool and came across nwjs. It seems to do a lot of the same stuff pkg does, but has a larger following, as well as more docs and a robust api. Can I use nwjs as a server-side executable (i.e. not using the desktop feature) the same way I would use pkg?
This answer states that nwjs "is an option, but it really isn't set-up to do a server - client type relationship", but then a comment says "you can launch a server from node-webkit just in the way you launch it in Node.js. It's just that node-webkit provide another way beyond B/S architecture".
So, is nwjs effectively the same as pkg, or fundamentally different?
I realize that there's also Electron, which states "build cross platform desktop apps" and appears similar to nwjs. I'm not trying to get into a Electron vs nwjs debate, but rather desktop vs. server, if there's a difference.
you got most things already, only few clarifications are needed. Reason nw.js / Electron declares itself as for desktop application is, it's core architectural design is intended to integrate node.js with chromium to have UI enables create application does have UI. You can still use part of those framework (node.js side) without initiating visible ui, in that case behaviorwise it'll be similar to plain node.js does. Still there is caveat, like as it tightly integrated with chromium in core already for some cases you should have screen to chromium correctly initiates (or creating virtual buffer as lot of CI does, or etcs).
Also, when your concern is performance, I'd doubt using UI framework for server side work achieves what you desire - while there won't be huge, integration between node to chromium have overhead compare to bare node.js obvioulsy.
Getting back to original question, I feel question itself is somewhat vague. If the intention is truly server side application probably you won't need to package it but correctly deploy node and its dependency modules or packaging it sort of installable manner instead of creating single binary as pkg does.
I have a web app where the front and back ends are both written in Node. The backend needs to run on (recent) Windows, OSX, and Linux. The front end, obviously, will run in a (modern) web browser, with pages served out from the backend.
For ease of deployment/installation, I would like to provide an executable file that installs "the right way" for each of those platforms. In browsing StackOverflow, I found a couple candidates:
1) I see that Electron helps make native apps that run cross platform, but I haven't seen anything that describes how Electron could listen on (say) port 80 and serve out the desired set of pages.
Is using Electron a rational strategy? Can anyone give me pointers to projects that work like this?
2) I also see that pkg (https://github.com/zeit/pkg) claims to produce cross-platform binaries. Can anyone give their experience with it?
3) Any other alternatives?
Free/Open-source somewat preferred, but commercial packages are a possibility. Many thanks!
#saille seems to have nailed it. Searches for "electron and express" on https://discuss.atom.io/ yield multiple articles for the combination.
pkg will also support an Express backend server.
So I do not plan to search for alternatives, but will investigate whether Electron or pkg work best for me.
The options I've found for creating desktop applications in HTML, CSS, and JavaScript are:
Electron (formerly Atom-Shell)
NW.js (formerly Node-Webkit)
However, there doesn't seem to be any clear implementation for using meteor.js with these.
NW.js
I've seen some other questions of people asking this, but no implementation. Can't even figure out by the answers what I should be trying to put together:
Meteor leaderboard app on node-webkit
Demeteorizer with node-webkit
How can I start a Meteor instance before launching a node-webkit?
This guys actually got it running but doesn't say how: https://stackoverflow.com/questions/25508737/iron-router-routing-fails-on-reload-in-node-webkit
The idea proposed here is interesting—loading the desktop application completely from the web. However, I would like to allow my users to use the application offline.
Electron
There is an actual implementation, meteor-desktop-app, but it has no clear support for Windows. However, the atom-shell does support Windows just as NW.js does.
Has anyone figured out an implementation to allow meteor.js to operate as a desktop application?
If you drop the code from meteor-desktop-app into Electron Starter, you'll get Windows + Mac + Linux for free, as well as a build system you can definitely use for Real Apps.
Check out mongoclient's scaffold directory, it'll lead you to your electron app if you follow the steps from readme.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to build a code editor in nodejs. There is option like using an express server to show editor and to execute code in backend. But that would require a browser. So I am looking for node modules that can provide standalone gui for windows platform.
There are a couple of different options, depending on how you want to proceed.
Option 1:
Use something like QT or GTK bindings to make a more traditional GUI application. These options generally are just Node bindings to the C/C++ API that GTK and QT expose. See node-qt and yue. Although these seem to not be actively developed.
Update:
You can take a look at NodeGUI: https://github.com/nodegui/nodegui
NodeGUI is a javascript library for building cross-platform native desktop applications with JavaScript and CSS like styling. It uses Qt under the hood and works on Mac, Linux and Windows.
It also has a react based renderer called React NodeGUI which is like React Native but for desktop: https://github.com/nodegui/react-nodegui
Option 2:
Use a framework that takes HTML, CSS, and Javascript and bundles it into a standalone HTML5 app. There are a bunch of frame works out there that do this. Examples include node-webkit and AppJS among many others.
I recommend using an HTML/JS/CSS Framework
Option #1: Electron by GitHub.
Website | GitHub Repo | Releases
It's easier than you think
If you can build a website, you can build a desktop app. Electron is a
framework for creating native applications with web technologies like
JavaScript, HTML, and CSS. It takes care of the hard parts so you can
focus on the core of your application.
Option #2: NW.js (previously known as node-webkit).
Website | GitHub Repo | Releases
Call all Node.js modules directly from DOM/WebWorker and enable a new
way of writing applications with all Web technologies.
Electron and NWJS Pros:
AppJS is officially deprecated
Electron is similar to NW.js but newer, more popular and has a bigger community and updates more frequently. I recommend it.
NWJS always uses the latest Versions of Chromium and Node while Electron takes more time to catch up.
NWJS supports [JavaScript Source Protection][1] by compiling it to V8 native code. Electron does not.
NWJS have a Legacy release for Windows XP and Mac OS X 10.6 support.
Electron and NWJS both use MIT license.
You can compare the contributions to electron with NW.js
Electron and NWJS Cons:
there is no out-of-the-bag run-time solution currently, so you'll have to ship it with your code (~50MB compressed and +100MB uncompressed) or find a way around it.
depending on your app, Electron/NWJS might considered an overkill especially since its startup time is less than ideal, just something to take into account.
no native look, you'll have to create your own UI elements using CSS or using some framework.
Option #3: DeskGap.
Website | GitHub Repo | Releases
DeskGap is a framework for building cross-platform desktop apps with
web technologies (JavaScript, HTML and CSS).
To enable native capabilities while keeping the size down, DeskGap
bundles a Node.js runtime and leaves the HTML rendering to the
operating system‘s webview.
Lightweight since the webview is provided by the operating system.
The API is still quite limited (pretty much a work in progress).
Requires new OS versions.
Apart from the other answers here:
You can take a look at NodeGUI: https://github.com/nodegui/nodegui
NodeGUI is a javascript library for building cross-platform native
desktop applications with JavaScript and CSS like styling. It uses Qt
under the hood and works on Mac, Linux and Windows.
It also has a react based renderer called React NodeGUI which is like React Native but for desktop: https://github.com/nodegui/react-nodegui
Also, its under active development.
I recently discovered https://github.com/yue/yue and I'm having nice experience. It's lightweight, has descent packaging support (and even react/JSX support) and is truly native with decent webview, portable and easy to build target platform's.
Although it seems discontinued I found this project unique, it's really native with options to add a descent webview. I retake some PRs and forked it and I'm adding TypeScript types and documentation since it's really clean/straight forward API, easy to build target platform files. this is my fork although I would like/searching for other users adding missing parts: https://github.com/cancerberoSgx/node-gui . The cons is that it implements node.js event loop so you must use yode (node.js fork) in order for promises and asynchronous code to work well with the GUI code.. m
I wonder if others have experience with this library or forks.
Answer specific to your question may be NodeGui (powered by Qt5, NodeGui-React)
There are many other options. I'm listing a few options below,
electron (Lets you write cross-platform desktop applications using
JavaScript, HTML and CSS, based on Node.js & Chromium)
carlo (Requires Node & Google Chrome to be installed on the system to
run)
NW.js (Similar to electron, provides Source code protection)
DeskGap (bundles a Node.js runtime and leaves the HTML rendering to
the operating system‘s webview)
Proton Native (does the same to desktop that React Native did to
mobile, based on https://github.com/parro-it/libui-node)
For more, you can use my github repo electron-alternatives to pick a cross-platform desktop development option.
Recently also Node-gir may be worth a look: https://github.com/Place1/node-gir
Allows to use Gnome/Glib/Gobject-based libraries from Nodejs. Will allow you to use GTK+.
I wrote an angularJS app (with nodeJS and ExpressJS as my server). My app is totally independent from the server (I used pouchDB for the data). I would like to create an app/package that can be run from a computer or tablet. How can I do that?
I'm sure there are already lot of questions/answers about this topic but I couldn't find the right solution so I apologize in advance!
Thanks
If you r looking for an full-stack framework, i can really recommend Ionic.
It is a framework, that contains it's own customizable ui-framework(build on sass bootstrap), it is build on cordova aka phonegap and makes it easy to deploy and test the code on android, ios, ... . It is also optimized for angularjs and offers for most functions a directive.
I really love it. I did write a blogpost in german: kkonstantin/ionic
Maybe take your existing frontend javascript code and make use of a css framework, to make it look great for all window sizes.
Like: Ratchet (build on bootstrap)
Then you just make use of Phonegap to deploy your html/css/javascript code to the plattforms.