desktop icon indicating copy to clipboard operation
desktop copied to clipboard

Use electron alternatives

Open SamuelScheit opened this issue 2 years ago • 26 comments

https://github.com/sudhakar3697/electron-alternatives

Why electron-alternatives?

  • Large size
  • Resource (RAM) hogging
  • Source code protection (https://www.contextis.com/en/blog/basic-electron-framework-exploitation)
  • We would already have a web component in the system that can be used.
  • Electron apps cannot be submitted to the Apple store (https://news.ycombinator.com/item?id=21437255)

There are better lightweight alternatives for electron:

  • DeskGap (bundles a Node.js runtime and leaves the HTML rendering to the operating system‘s webview)
  • Neutralinojs (chromium module is replaced with either user’s web browser or built-in browser component. Node run-time is replaced with a lightweight web server which exposes native OS functionality)
  • electrino (simple system built-in web-view)
  • Tauri (Build smaller, faster, and more secure desktop applications with a web frontend)
  • Sciter.JS (Is a 5MB HTML/CSS/JS (ES6) runtime aimed as a direct Electron replacement)

SamuelScheit avatar Aug 08 '21 10:08 SamuelScheit

While I don't want to personally be using electron, most alternatives have at least one or two flaws with them.

  1. Use native web view, while in theory this sounds like a great idea, certain systems could have insanely outdated browsers backing the web view and in some cases features just straight up break because of the browser being used in particular. For example, WebKit is super inconsistent between platforms and systems, on my system personally most web pages fail to render properly. Although, this is still a great approach for Windows where the web view is commonly backed by a Chromium engine, but then we would need a separate build. (this affects DeskGap, electrino)
  2. Lack native capabilities, both electrino and Sciter.JS look like nice alternatives but both list the lack of a Node.js backend. (though if it comes in the near future, I would definitely look into them again, electrino may not provide all the electron APIs we need either)
  3. Straight up don't work. I've tried both Neutralinojs and Tauri, haven't managed to get either one to work properly. (it may work now but other issues stand)
  4. Don't have a stable ecosystem. Electron has thousands of developers on it already and there's a few native features the app provides which are provided through electron specific libraries, while this could be done manually, it will require extra time.

I think for the time being, leaving this to end users to create alternatives is probably the best idea, there is already a 3rd-party web view backed app available and I can probably expect people to make native apps as well, someone mentioned they wanted to build a Qt app.

insertish avatar Aug 08 '21 11:08 insertish

I heard there a way to build your app by using Servo, an open source web engine made from the makers of Firefox and powered by Linux Foundation.

https://servo.org/

shawny43 avatar Sep 16 '21 20:09 shawny43

I think it's still early days for Servo, a lot of major things are missing and the app refuses to run in Servo anyways.

insertish avatar Sep 16 '21 20:09 insertish

Best practice is uses os built-in native UI toolkit for example macOS Cocoa. But this choice will increase development cost.

However this choice will be best if you prioritize accessibility, performance, optimization per platform. 🚀

Genbuchan avatar Dec 12 '21 18:12 Genbuchan

Realistically, maintaining separate clients wouldn't be possible for us at this stage - it'd also likely introduce various inconsistencies across platforms. However, using an Electron alternative may be possible at some point and is something we may consider doing in the future :)

Rexogamer avatar Feb 06 '22 18:02 Rexogamer

Best practice is uses os built-in native UI toolkit for example macOS Cocoa. But this choice will increase development cost.

However this choice will be best if you prioritize accessibility, performance, optimization per platform. rocket

And then Linux entirely falls into the water as there's no "One fits all" solution to Linux system webviews as far as I'm aware :man_shrugging:

cyrneko avatar May 27 '22 12:05 cyrneko

I'm just going to bump this as I'd like to say that recently Tauri hit version 1.0 and is now in a stable release. I have a feeling that whatever issues you had then most likely have been mitigated.

https://tauri.app/blog/2022/06/19/tauri-1-0/

FelixKLG avatar Aug 12 '22 18:08 FelixKLG

Should go to React Native for Revolt Chat? This could help for mobile platforms and Desktop.

shawny43 avatar Aug 12 '22 19:08 shawny43

I'd also like to bump since I've personally found out about Neutralino a few days ago and it works like a charm.

ggtylerr avatar Aug 13 '22 11:08 ggtylerr

Just dropping a little update to this, someone did do a little preliminary test and I will probably try it out too but, it may be the case that we use Tauri for the new client that's currently being written if all goes well.

Should go to React Native for Revolt Chat? This could help for mobile platforms and Desktop.

React Native is great until it gets a bit more complex at which point it can be a pain to work with.

Edit: also also, this isn't for desktop but Infi is working on a native Android client we will be distributing going forwards

insertish avatar Jan 24 '23 18:01 insertish

Edit: also also, this isn't for desktop but Infi is working on a native Android client we will be distributing going forwards

Is there a public repo for it yet?

ggtylerr avatar Jan 27 '23 20:01 ggtylerr

The app is still in early development; the repo is currently private.

Rexogamer avatar Jan 27 '23 22:01 Rexogamer

Understandable, have a good day 👍

(Also the stuff in your email that has the unsubscribe link is in your comment)

ggtylerr avatar Jan 27 '23 23:01 ggtylerr

Apple's Safari remains one of the biggest problem for cross platform apps, and I don't think that will change anytime soon. That said I'm excited to see how Tauri implements mobile cross platform in the future but I don't see any viable alternatives to the status quo in the short term.

toastxc avatar Jan 27 '23 23:01 toastxc

As Pakrohk suggested in #105 a native app would be a cool feature, especially for people on low end PC's (not me). I think that Flutter might be a good alternative to electron. With one codebase you get a native app for everything - windows, linux, macos, andorid, ios. If you used an object oriented language before Dart is pretty easy to learn, I would say it's java, but better. Also more static (you can't for example load new code at the runtime, but this isn't very important here). I don't say Dart & Flutter are perfect, but they are definitely worth considering. (Flutter is a framework for the Dart language)

SzczurekYT avatar Feb 02 '23 09:02 SzczurekYT

I think that Flutter might be a good alternative to electron.

The major issue with this is that we just don't have the time or team required to completely switch to a new framework and language. It would require replacing every part of the frontend and require having to rebuild all the components we use from scratch.

insertish avatar Feb 02 '23 09:02 insertish

I think that Flutter might be a good alternative to electron.

The major issue with this is that we just don't have the time or team required to completely switch to a new framework and language. It would require replacing every part of the frontend and require having to rebuild all the components we use from scratch.

Yeah, unfortunetly this isn't easy.

SzczurekYT avatar Feb 02 '23 14:02 SzczurekYT

Actually I want to try to recreate Revite just in Flutter and Dart as a proof of concept. Can I try to do that? Can I reuse the assets? If I understand the licensing stuff correctly I must license my project under GNU AGPL v3.0? I will probably give up or get bored after few days rather then make something functional, but still I want to at least try doing this, might be a fun project.

SzczurekYT avatar Feb 03 '23 09:02 SzczurekYT

Socket Runtime looks somewhat promising, it has an option to use a node.js backend. It is quite new though I'm not too sure if it's as great as people say. It is probably worth looking into though

https://github.com/socketsupply/socket

barnabwhy avatar Apr 14 '23 11:04 barnabwhy

Actually I want to try to recreate Revite just in Flutter and Dart as a proof of concept. Can I try to do that? Can I reuse the assets? If I understand the licensing stuff correctly I must license my project under GNU AGPL v3.0? I will probably give up or get bored after few days rather then make something functional, but still I want to at least try doing this, might be a fun project.

I started by trying to recreate the components lib, but quickly got bored of that, so no app sorry. I also noticed that while Flutter is really nice tool, its' desktop support isn't very ironed out and lacks some features (for example right clicks aren't supported everywhere). I think it needs a bit more time before it will be ready for big desktop apps. In the meantime Tauri looks promising so it's probably the best option right now (or some other electron alternative) as you don't need to switch the framework / language.

SzczurekYT avatar Sep 18 '23 19:09 SzczurekYT

I started work on my own client a while ago but I haven't been able to work on it much due to college and work. It's made in Python with PySide6, with Advanced Docking System as its layout and fman build system for building to a native client. I'm planning on releasing the source code once I get (at the very least) messaging and server/channel list working.

Also side note...

In the meantime Tauri looks promising so it's probably the best option right now (or some other electron alternative) as you don't need to switch the framework / language.

Tauri is good as a stop gap but it's definitely not a solution. You're still rendering it in chromium (at least depending on the OS), which could be helpful if multiple apps are using the system framework, but it's still essentially the same workload. (That being said, it's good for the original purpose of this issue, which is to use an alternative to Electron and not just using a completely different framework, lang, etc.)

ggtylerr avatar Sep 19 '23 01:09 ggtylerr

I'm experimenting with Tauri WASM to see if its a good solution for web & desktop, it does still run using web technologies however there are many benefits to that as well.

toastxc avatar Sep 24 '23 10:09 toastxc

Tauri is good as a stop gap but it's definitely not a solution. You're still rendering it in chromium (at least depending on the OS), which could be helpful if multiple apps are using the system framework, but it's still essentially the same workload. (That being said, it's good for the original purpose of this issue, which is to use an alternative to Electron and not just using a completely different framework, lang, etc.)

Sorry to be that guy, but that's not fully true. You will only use the bundled WebView 2 engine, which is based on Chromium and only on Windows with Tauri. This is much more efficient than Electron because the native OS engine is running anyway, thus binary size and memory footprint decreases greatly.

[They are very small because they use the OS's webview. They do not ship a runtime since the final binary is compiled from Rust.](https://tauri.app/v1/references/architecture/)

Tauri is many times more efficient than an Electron app. They have a benchmark page in their docs which explains this in more detail, so I think to reduce the maintenance workload of different apps for different OS's Tauri would be a great option :) Also, Tauri v2 will support iOS and Android as well so for a small team like the one of Revolt this could be good because you only have to maintain one codebase for all platforms.

RayJW avatar Sep 25 '23 08:09 RayJW

The mentioned article now redirects to accenture.com. Here's the archive.org version so the future readers don't have to hunt.

shellheim avatar Nov 16 '23 17:11 shellheim

Should you can create revolt on gtk app or QT if nothing works?

shawny43 avatar Nov 16 '23 17:11 shawny43

Should you can create revolt on gtk app or QT if nothing works?

In terms of native desktop apps:

  • fwiw there is someone building a GTK client currently (will eventually replace the repo at revoltchat/mutiny)
  • and the iOS app may be ported to macOS in the future

insertish avatar Nov 18 '23 15:11 insertish

Tauri is currently slated to be adopted with https://github.com/revoltchat/frontend/issues/14

insertish avatar Mar 28 '24 11:03 insertish