Readit News logoReadit News
Posted by u/david90 9 years ago
Ask HN: Do you think Electron is good for building Desktop Apps?
At Oursky, we built several apps with electron.

We find that it's easy to set up, you can use npm packages. Yet the build size is quite big and it might not support all native features. What's your thoughts?

pavlov · 9 years ago
Regardless of whether the HTML+JS+CSS stack is good for desktop apps... The one thing that bums me about Electron is that it bundles an entire web runtime with each app, even though a suitable runtime already exists as part of the operating system.

Seriously, WebKit on Mac and Edge on Windows would be just fine for >99% of Electron apps. Using the available web runtime would be a tremendous saving both in build size and memory usage.

Did you know that Chromium contains 25.3 million lines of code? [1] Each Electron app is bundling a separate copy of that enormous codebase in binary form. It's a terrible waste of memory.

It's true that supporting the native web runtimes would be more work for the Electron framework developers, and sometimes would also mean more work for app developers... But most web apps have absolutely no good reason to be tied to Chromium, so for app developers the diversity would actually be beneficial in the long term IMO.

If someone wants to start a project that's like Electron but uses the native runtimes, I'd actually like to contribute some work. Let's call it "Electrino"?

[1] https://twitter.com/worrydream/status/857794605076500480

mijoharas · 9 years ago
For me, I'd just love it if progressive web apps would have a desktop offline install mode that allowed them to deliver notifications, a desktop icon, and a separate window.

I was expecting this to happen after chrome discontinued their "chrome apps", that the underlying tech would come back with progressive web apps, but I haven't seen anything in that space.

I think it would solve the problems with Electron apps (wouldn't have to rebundle the runtime for a massive binary size and massive memory use).

If anyone knows if anything is happening in this space (progressive web app installation for desktop) please let me know.

crucialfelix · 9 years ago
I am looking forward to more PWA and I agree this would replace most use cases for Electron, but not all.

If it's just a web app (network, localStorage etc) then it would be fine. But if you need to read/write to the user's filesystem or need to include other executables then we can't run that in our browser. We don't want a webbrowser to have any possible path to screwing with your filesystem or running executables.

gcoda · 9 years ago
There is a flag for it. I was surprised that my website 'installed' on my Linux PC, created a '.desktop' file and launched in a separate window. It works now, only bug I encountered is asking 'add do desktop' while I already launched it from desktop
awjr · 9 years ago
Look at it from a product owner's perspective. I want 100% of users to have the same experience. Electron bundling a web runtime that gives the same experience on each platform is absolutely key to giving them the same experience. There may also be security issues to consider.
pavlov · 9 years ago
Look at it from the computer owner's perspective. I don't want your experience if it comes with 100+ MB of redundant code.
awinder · 9 years ago
Which product owner? Totally agree with you, but the reason why it's delivered this way right now is a technical implementation detail. Electron could focus on delivering an API that abstracts away differences between runtime engines (as most web frameworks do). I'm sure bundling chrome in is a boon to simplicity inside electron, so maybe the distinction matters within electron, but i'm not sure that distinction should matter for downstream projects...
detaro · 9 years ago
Not wanting your users to have an "experience" that matches their OS IMHO is bad design.
nradov · 9 years ago
That is not a valid thing to want. The experience is supposed to be different on each OS.
bkor · 9 years ago
That web runtime doesn't ensure that people have the same experience. You're still relying on the abstractions of that runtime. Plus that there haven't been any changes to it.
pavlov · 9 years ago
Well, why wait. I made a repo for "Electrino":

https://github.com/pojala/electrino

Sorry, it's totally empty! But I'm hoping to get around to making a Cocoa+WebKit proof-of-concept this week. I guess the starting point would be to implement just enough APIs to be able to run the main.js example from this Electron tutorial:

https://github.com/electron/electron/blob/master/docs/tutori...

WorldMaker · 9 years ago
Another direction might be to extend Cordova to support macOS and Linux. Cordova already supports building UWP for Windows Desktop/Xbox/HoloLens using the native HTML+JS stack. Seems to me like a lot of existing Cordova plugins just need subtle nudges to support macOS in addition to iOS. Then you just need a good Linux solution and you cover all the desktop environments.

Then narrow the few missing desktop-focused APIs that Electron has but Cordova doesn't have good plugins for. (It would also be nice to support more Node-like background processes in Cordova and more Node-native libraries, but you would need to find a good balance that plays well with mobile.)

pavlov · 9 years ago
Update on Electrino: implemented minimal APIs to load Electron's "Hello World" example. Code is in the repo.
efdee · 9 years ago
Only having to target a single browser does make life easier for application developers. It's like programming for the web, but without the hassle of cross-browser compatibility.
PaulHoule · 9 years ago
It just astonishes me how big the slack install is. It is like installing the latest video drivers from Nvidia or AMD.
scarface74 · 9 years ago
What's the purpose of the Slack desktop app? What does it do that the web app doesn't?
k__ · 9 years ago
Isn't this more of a philosophical problem?

Static binding vs dynamic binding?

Bundling everything up so no outside deps are needed vs using everything that is on the system to save space?

pavlov · 9 years ago
Yes, and I wish developers could make that choice more easily.

The Electron approach is fine for genuinely large applications. But I've seen many Electron-based Mac desktop apps where the UI has a handful of elements. The equivalent Cocoa app would be maybe 100 kB.

I understand that people won't learn Cocoa just for tiny UIs, so it would be really nice if there were a mostly Electron-compatible solution that would use the system web runtime which is already there (and probably already loaded in active memory).

theflork · 9 years ago
OpenFin claims to have remediated the memory issues of electron somewhat.

https://openfin.co/2016/11/04/openfin-slashes-electron-memor...

mmgutz · 9 years ago
The con is not all browsers support the same features. Sure, we've come along since IE6 and Mozilla but if I'm creating a web-based desktop app, I want to deploy with 100% certainty that the CSS/JS I used works exactly the same when I was developing it.
pavlov · 9 years ago
Update: I decided to build a proof of concept for Electrino. It can run a "Hello world" now.

Here's the Show HN:

https://news.ycombinator.com/item?id=14260755

skdotdan · 9 years ago
Or even Chrome itself.
interfixus · 9 years ago
I am a retrograde, grumpy, obtuse old curmudgeon, so let me bite:

No, it is a terror. Applications produced with it are bloated monstrosities, gobbling up hundreds of megabytes in both storage and RAM before getting round to as much as putting a checkbox on screen. Bundling an entire web browser inside your program in order to provide portable GUI functionality like what Tk managed more than twenty years ago without breaking a sweat, and at roughly 1/100 the size, yeah, sure, it flies. So did the Spruce Goose, sort of.

But then, I never took to js, I never took to Chrome, I never took to bloat as a way of life.

[edit: typo]

analognoise · 9 years ago
I agree with you and take it a step further:

It is totally embarrassing that programs are 100-1000 times the size they used to be, and slow. I think it shows an overall disinterest in our tooling and field, and it's shameful.

codefined · 9 years ago
Another thought, however, an application I wrote is 30MB when packaged. On an average internet speed, this takes ~16 seconds for your average internet speed (15mbps). Even on 1mbps, it only takes 4 minutes for the application.

When unpacked, it weighs about 100MB. This disk space costs roughly £0.004 for an HDD or about £0.020 for an SSD.

In exchange for these extra costs, I get to use HTML, CSS and JS on both our website and our desktop applications and they get to share the same codebase. That alone must saves me 50% of the time. The fact people might have to spend upto 3 more minutes to download my application and that it costs them 2p to install it on their SSD is minimal compared to the fact that I can have twice as many features in the same amount of time.

mikhailt · 9 years ago
Electron is acceptable for seeding the development of a new idea, product, and/or platform.

However, as the team and product grow up, it becomes less acceptable as users expect more performance by going more native and deeper integration with the OSes.

Sorry but Electron is not the future for me. I dislike the memory consumption it eats up. There is nothing acceptable about a simple chat app eating up 1GB of memory when the identical IRC client I had was using 100KB and has more features and the same client was built back a long time ago.

As for others talking about how there's plenty of disk storage and memory, that's lazy. We're losing a generation of native coders to people who only know about Javascript and never taking the step to learn more about how bare metal works, effectively losing all the knowledge of optimizations, iterations and programming skills we've learnt in the past three decades.

I can assure you, you can stick with Electron apps only for your business but the moment I find a native version of the same apps, I'm done with your business too. Slack, VS Code/Atom, etc, none of them are on my recommendations list and they will never be until they either go native or there's a native competitor. Sublime Text destroys VS Code/Atom completely and yet, the version they've built 5+ years ago is still better than Code/Atom today in pure performance despite all of improvements Atom has done.

kayoone · 9 years ago
That is the right opinion and programmers should think like this, but i also believe that this kind of thing is hard to stop when it makes it easier for devs to churn out software with existing skills and most non-technical users do not really care anyway. I guess it is a reality we have to accept and wait for web-tech based desktop app development solutions to mature. Maybe react-native is the way ?
mikhailt · 9 years ago
Technology moves in cycles. We went through this back in 90s and 2000s with Flash, Dreamweaver, ActiveX, Ruby, PHP, and etc.

I suspect we'll see us going from Electron > React-Native or identical and then realizing the benefits of native stuff and back to native code once MS/Apple/other OS try to replicate the ease development process with their languages like Swift, C#, Go, and etc.

longsangstan · 9 years ago
"users expect more performance by going more native and deeper integration with the OSes" "the memory consumption it eats up" Most users are not programmers. I doubt they can tell whether slack/spotify are native apps or not.
ionised · 9 years ago
No, but they can tell when their cheap laptops start to slow to a crawl because the memory usage of three or four apps is obscene for the features they offer.
smilesnd · 9 years ago
When you have a hammer everything looks like a nail. I personally hate electron for multiple reasons.

First why would you use web technology to build a desktop app? I could understand if their wasn't a cross platform answer like python and java that are high enough languages that even middle school kids can learn to make desktop apps with. Yet lets default to language and markup language specifically design for a client server relationship.

Secondly from my experience electron runs horribly on linux and windows. I can always tell a desktop app uses electron on my desktop not just by the larger then normal amount of resource it takes to do simple task, but because it will randomly crash. It crashes silently and instantly reboots it self and try to act like nothing happen but it happens so often that I catch it when it does.

Thirdly, I am not about to act like I am some type of security expert, but this is just screaming at me security risk. Electron uses at least 4 engines, how and when do they get updated and security patches installed? Can the programmers stop upgrades of these engines to insure that their app will continue running as is? You can argue all things are security risk, but when you put so many complex engines in one app it is bound to make it difficult to keep up with all the security concerns.

I could keep coming up with more and more reasons why electron is horrible solution to a problem that already has solutions. The appear to webs to keep using technology they are comfortable with is horrible reason to justify this Frankenstein of a code base.

Can_Not · 9 years ago
> python

Literally the only advantage of this is the lack of DOM related performance issues. Support for mobile is probably a nightmare and you still have to make the website anyways, so might as well write it once. Also trying to combine cross platform, speed, and 3 sounds like it's own nightmare anyways.

> Java

Much more practical option, main cons involve large JRE download and I still have to write my website in JS anyways, so why write it twice? React Native really brings the mobile performance up to par that fits 95% of non-game use cases.

This next statement is not directly related to the parent comment: I'd like to read more about why eletron alternative​s are better (or exist) and less about how electron is slow or some other thinly veiled hand-wavey "bad because js".

smilesnd · 9 years ago
>python comment - Electron doesn't support mobile so I don't understand this comment. Their are lib for python on mobile good, bad, or evil I don't know. It isn't just a lack of DOM related performance issues it is also V8 performance issues, chromium performance issues, and electron performance issues. When you stack a engine on top of a engine on top of another engine you can't expect to achieve awesome speeds. And if you are making a desktop app why would you even care about making a website of that app?

>Java Again if you are making a desktop app why would you also need a website performing the same task? React Native is for mobile apps electron is for desktop apps so I don't understand why you are bring this up as well.

Electron exist same reason nodejs exist webbies to scare to learn another language. JS isn't bad, but how people use it makes it bad. I should actually say programmers are to scare or lazy to learn alternative solutions to a problem. It is simpler to use what you already know then to try something else. What does electron bring to the table? A way for someone that know JS, css, and html to produce a cross platform desktop app that is it. You don't gain performance, security, and it isn't the only cross platform solution like Java once was. People use to use Java only because it was the only cross platform solution. It had horrible memory leaks and all sorts of issues that still plague it to today. Yet it was the only cross platform desktop solution of its time. That is why electron is seen as useless to me I know how to program in c, c++, c#, JS, and elixir. I would probably learn python stack if I wanted a cross platform solution to a desktop app.

AstralStorm · 9 years ago
You forgot about multiple incompatible bundled versions of Electron all around. Now that is a real security issue.
patleeman · 9 years ago
I built Collate (https://collatenotes.com) with Electron and I'm a huge fan. Electron does has its downsides but I think that it's eclipsed by the upsides. For collate, those upsides are:

1. Ease of building and distributing packages with Electron-Builder. I'm able to build for all three operating systems on my Mac, took a few hours to set up.

2. Access to the vast NPM library for all sorts of functionality.

3. Ability to use CSS libraries for styling. I'm no designer so it saves me some time. Collate uses Bulma for styling.

From what I've seen, users are more than happy to have an application that solves their need no matter what it's created in. Most people don't really think about file sizes, or the fact that Chromium is packaged with Node, they just want their problem solved without visual or performance hiccups.

If it wasn't for Electron, Collate would be a very different application or non-existant. I think people need to look at Electron as opening the door to more possibilities.

nirvdrum · 9 years ago
FWIW, I didn't mind the overhead of Electron when I only used a couple apps built with it. Now that that number is increasing, I find myself having to monitor resources & battery life and selectively killing apps. I have concerns that this approach isn't going to scale.
toddmorey · 9 years ago
This is a really good point. Could two electron apps share a chrome runtime? Has to be a way to make this more efficient.
romanovcode · 9 years ago
The only good point Electron has is 1. All other points are obsolete.

- You can find libraries for "all sorts of functionality" with ease for native languages - Swift, C#, Python (Mac, Win, Linux).

- In the end the ability to use CSS is harming user because now you don't have default OS element styling and every app is using it's own styling for things like buttons - this is very bad.

seanwilson · 9 years ago
> If it wasn't for Electron, Collate would be a very different application or non-existant. I think people need to look at Electron as opening the door to more possibilities.

Exactly. If you're building an app yourself you'd never have the resources to make a native app for Mac, Windows and Linux. Nothing is perfect in software development. Electron is a decent tradeoff for certain projects. Regular customers aren't going to even consider disk space or memory usage unlike many vocal commenters in this community.

jedikv · 9 years ago
>"From what I've seen, users are more than happy to have an application that solves their need no matter what it's created in. Most people don't really think about file sizes, or the fact that Chromium is packaged with Node, they just want their problem solved without visual or performance hiccups."

To be frank, most users often don't have a better performant alternative (outside of maybe a browser tab) so it seems like a redundant point.

lioeters · 9 years ago
I'd say Electron is "good enough" for many purposes, meaning its advantages overweigh the disadvantages. Lower barrier to entry compared to native solutions, developer productivity, cross-platform sharing of code.. Plenty of large companies use it to build (even flagship) products.

The disadvantage that is most talked about is its final bundle size, and I'm not aware of any developments that are trying to solve it. I'm in a project with a number of Electron apps built and in the pipeline, and we're searching for a potential in-house solution, of a central app that hosts/downloads/embeds "mini-apps" that run on the same foundation, to share the same Chromium run-time. Really hoping for a community solution to this though.

KeitIG · 9 years ago
There is an issue on Github with the idea of creating a runtime for Electron: you would only need to package your apps and a shared Electron runtime would execute the different app you have installed on your OS, a la Adobe Air.

https://github.com/electron/electron/issues/673

lioeters · 9 years ago
Thank you for the link, the whole thread was very informative, for the various ideas being weighed and some kind of consensus forming as to the proposed solution.

It got a bit daunting to see in more detail the potential complexity of the problem. Someone noted in the comments here, that there have been countless attempts at solving this "shared runtime for cross-platform apps" idea, apparently with a still unsatisfactory history.

Reading through the thread does give me hope, since the discussion is on-going after 2+ years, which means people are interested in an efficient solution. Seeing the HN crowd go at this Electron topic again and again, always with a kind of emotional "turbulence", implies that this is a worthy problem to solve.

I like that one of the recent suggestions is to "split the Electron", to accommodate bindings with theoretically any language.

foepys · 9 years ago
After seeing what disasters Adobe Air, desktop Java, and Flash have been, why do people think that they suddenly can do better?
tonyedgecombe · 9 years ago
They would need to introduce some kind of stable release for this to be effective, at the moment they seem to be releasing every couple of weeks: https://github.com/electron/electron/releases
ohstopitu · 9 years ago
I used to use linux desktop since 2012(ish) and I remember the time when most of my apps were Windows and Mac only! As a broke university student, I could not afford to upgrade to a Mac just to use some tools!

Electron has made me forget those days! Today, most of the tools I use are available on all platforms and while they do take up a lot more ram and disk space - both are generally things I can buy and fit on my computer and will be supported out of the box but not having those apps won't.

I know it's great to hate Electron because of how much ram and disk space it takes, but for those few on Linux, it's truly made life easy!

interfixus · 9 years ago
I am the retrograde, grumpy, obtuse old curmudgeon of a comment somewhere above. Running everything on Linux for all of this century and a bit of the last one as well.

As you may surmise, I do not entirely agree with you: I have tried the odd Electron application, but I don't think any of them lasted a week on my desktop. It's not just the bloat in itself. Software built on what I consider iffy technologies - somehow I never really manage to trust them or just feel reasonably comfortable with them.

ohstopitu · 9 years ago
oh I totally agree, almost all those apps don't fit in with Gnome or even Unity (almost all electron apps feel out of place). But imo, it helps make life slightly easy!
untog · 9 years ago
I'd be wary of taking HN's opinion as gospel unless your target market is HN users.

I don't like Electron apps particularly, but I understand why people make them. I think that if your desktop app is "the thing" you're making then you should avoid Electron if possible, as it does provide an experience that's subpar. But if your desktop app is just a convenience offering for your product that lives mostly on the web, I think it's fine to use it.

(there are exceptions like VS code, but they're very finely tuned compared to the average Electron app)