Ask HN: How do you create a cross-platform GUI without using Electron?
I have the idea of an app that is mostly about communicating with an API on the WEB. It feels a considerable overkill for an Electron App. The size of a hello world app in Electron is 100x the size of my backend!
On the business side, I understand that many people on HN prefer to ship that spend time on technologies discussions.
But if you have the time, and your goal is to do something maintainable, reasonably close the most to the Desktop, and well-integrated to the OS, what tech/stack will you use?
Windows/Linux GTK/MacOS
111 comments
[ 5.3 ms ] story [ 169 ms ] threadAs for Javascript, you can use Electron or React Native but I don't know how far along React Native on the desktop is compared to Electron.
Hope that helps and someone may come along that could speak in more depth on one or more of these packages for your use case.
Qt [1]
The main codebase is C++, but bindings are available for Python and several other languages. I have developed and shipped multiple cross-platorm applications using Qt, using both C++ and Python. Documentation and source code examples are readily available.
JUCE [2]
Another C++ framework, with Python bindings. The focus is on music and audio apps, but a cross-platform GUI framework is also part of the library.
Blazor Desktop [3]
I have developed C# web applications using Blazor and WASM and moved them to the desktop easily. Using C# and the Dotnet ecosystem is really interesing and worth looking at.
Flutter for Desktop [4]
Still in beta, but has the support of Google, for better or worse.
JavaFX [5]
A Java cross-platform still under active development. I think it is pretty nice if you like Java.
Red [6]
Let's add an outsider just to keep things interesting!
This github site seems somewhat current about other Electron alternatives as well. [7]
Good luck! You will find there are lots of alternatives out there.
[1] https://www.qt.io/
[2] https://juce.com/
[3] https://visualstudiomagazine.com/articles/2021/02 /17/net-6-preview-1.aspx
[4] https://flutter.dev/desktop
[5] https://openjfx.io/
[6] https://www.red-lang.org/p/about.html
[7] https://github.com/sudhakar3697/electron-alternatives
Here's an example of what it could do on macOS four years ago: https://www.red-lang.org/2017/07/063-macos-gui-backend.html
Edit to add: You can build cross-platform GUI apps in Red now but, while they're very close to the finish line, and making progress every day, there are still a few missing pieces yet to complete on the 1.0 roadmap.
[1] https://mudblazor.com/
[2] https://mudblazor.com/components/table#api
If your funding or revenue is $50k and under, there is no cost, but there is a "Made with JUCE" splash screen.
If your funding or revenue is $500k and under, $800 one time fee and there is no splash screen.
You can pay $2600 once with no revenue or funding limit and no splash screen.
Free for education.
GTK feels right at home in the GNOME desktop environment (which I use, and like!) but for cross platform I don't really think it feels native at all. As a user, I've had much better native experiences with QT or WxWidgets to be honest (on Windows, at least).
That's not true since GTK3, where GTK started to look like GTK regardless of the platform.
http://fyne.io/
Something that was mostly native for all of them.
Currently the only alternative to Electron that is similar is a program that hosts a local webserver and the local browser is pointed at it, but that's a second class experience.
Hello World (GUI) shouldn't be a 50MB deliverable. If I'm providing someone with a toaster I shouldn't have to ship a whole mobile home. Nor should that end user need to park 300 mobile homes on their hard disk.
There are other criticisms about wxW in specific linked from the wikipedia page... https://en.wikipedia.org/wiki/WxWidgets#Criticism
Dolphin's is illustrative of the pain involved in using that widget set. https://dolphin-emu.org/blog/2017/06/03/dolphin-progress-rep...
https://tauri.studio/
I really liked it. It was awesome to use something I'm familiar with (Next.js) and have it drive the UI. Resulting application was indeed about 1MB after all said and done.
The whole reason electron was created is because using a random unknown browser on the OS has random results.
https://github.com/sudhakar3697/electron-alternatives
[0] https://docs.nodegui.org/
[1] https://react.nodegui.org/
[2] https://vue.nodegui.org/
[3] https://svelte.nodegui.org/
It's open source, the code has always felt reasonably clean to me, and it gives your apps native look and feel.
And it is ridiculously fast compared to alternatives.
I'd like to know what the "native experience" is supposed to be, but I have no idea which of the numerous Microsoft UI APIs is officially current. So far I've just punted and I'm using macOS shapes and sizing and using the colors from the Metro? style; at least it will look tasteful and not stand out too much color-wise.
That's the one. Everything else has never gained enough traction.
1: https://sciter.com/
> Free and open source: https://www.lazarus-ide.org/index.php
> Other 30+ cross-platform GUI toolkits / frameworks: https://www.slant.co/topics/983/~best-cross-platform-gui-too...
Lazarus has the opposite problem of all the other UI toolkits - relatively awesome UI across all platforms (especially if you're a fan of WinForms) but stuck with only support for Pascal.
I've probably written GUI apps in C, Java, Ruby, Objective-C, Swift, JavaScript, and probably a couple I forgot about. Dart+Flutter come the closest to being "good" and correct. There's some missing documentation for Desktop development with regards to Flutter + Dart but nothing is totally intractable if you're willing to read through issues. My only caveat is that Google is truly an awful company to depend on for your business; since, they 100% do not give a a single fuck about you unless you're paying them ~$100 million or more a year, or an EXTREMELY high profile client.
I've been getting ready to give Pascal a solid try but I still totally lose my mind when working in Lazarus (like where did the thing I just used go? Ah yes, tiny, free-floating window, of course). I have a feeling Pascal is probably the real diamond in the rough of UI application development these days.
Qt is probably fine but their licensing turns me off from ever using or considering it.
But flutter looks like a good option.
If I may ask why? They provide GPL and LGPL, and this last one is quite permissive.
See: https://www.qt.io/licensing/open-source-lgpl-obligations
> In case of dynamic linking, it is possible, but not mandatory, to keep application source code proprietary as long as it is “work that uses the library” – typically achieved via dynamic linking of the library. In case of static linking of the library, the application itself may no longer be “work that uses the library” and thus become subject to LGPL. It is recommended to either link dynamically, or provide the application source code to the user under LGPL.
RAD Studio 11 just got released and allows native development for "all platforms" from a single codebase and GUI at the click of a button. [0]
I have ranted about and harshly criticised Embarcadero's misguided product policies as much as the next guy but that doesn't change the fact that Delphi is still the most mature and versatile Rapid (sic) Application Development environment out there, especially if UX and UI are important to you.
And the twenty-year old adage that you can knock out an MVP with a really nice and polished GUI in a Saturday afternoon is now even more true than ever.
In the end, a native binary with a small footprint (easily 1/100th the size of an Electron project) will fall out at the press of the F9 key and that's really something to behold...
The free Delphi community edition [1] might even offer all the features that you need, although I really wish Embarcadero would see the light already and sync its release cycle with the full version.
Delphi might not officially be regarded as hip or cool these days (mostly due to severely and ongoing errant product and community management by the company that makes it) but some great people and brilliant minds are associated with it and compared to the olden days Delphi is now somewhat of a secret underground Swiss army knife that ironically gets used now mainly in big and medium corporations.
I like to think its versatility combined with the fact that it's technically uncool and against the mainstream to do projects in Delphi these days might fit a hacker's (and HN user's) mindset very well...
[0] https://www.embarcadero.com
[1] https://www.embarcadero.com/products/delphi/starter?aldSet=e...
[1] https://www.lazarus-ide.org/
Lazarus is Free Software, which is awesome, and its feature set is also mature and impressive (I wouldn't have thought that the project also has a 20+ year history already).
I do recommend it highly if you can't get your hands on Delphi, don't want to support Embarcadero's antics, or work with an open-source project anyway. Several major component developers, including the great guys at TMS with their cloud pack and Raspberry Pi components [0] make a ton of awesome components that are available for both Delphi and Lazarus and I can highly recommend them.
If you're operating in the commercial space and have a budget, a bigger team, strong network, database or certain other commercial requirements, you might appreciate the support options and greater choice of 3rd party components which can be installed in Delphi with just a click and that save just so, so much time in getting your product to market.
If you're learning or teaching the language, working in a small team or alone, or require a feature set fully supported by Lazarus or just like free software, I wholeheartedly recommend Lazarus as a great alternative indeed. If you're somehow in the middle, check out the Delphi Community Edition too and just find out what suits you better. I guess it also comes down to what you're used to...
[0] https://www.tmssoftware.com/site/products.asp?t=lcl
Yeah no kidding. Last year I tried to download the trial of their paid C++ IDE. The licensing tool wouldn't work, and support never returned my emails. People complained in the official forum, no company response their either. I took that to mean "We see you as such a low-value potential customer, we won't lift a finger to get our own demo to work for you".
> Delphi Community Edition is a full featured IDE for building iOS, Android, Windows and macOS apps ...
But looking at the feature matrix for the full product it says:
> deploy to the platforms you need to support and with RAD Studio that includes Windows, macOS, iOS, Android and Linux!
> Build Linux client / server applications (includes FMX GUI for Linux) The RAD Studio Linux Compiler enables compiling applications to popular Linux platforms. FireMonkey GUI for Linux extends the FireMonkey UI framework to provide full Linux GUI support.
Only offered on Enterprise ($4K) / Architect ($6K) editions.
For a moment I was tempted to look into Delphi again, as I have spend many years in that environment. However, I see now its free until you hit USD 5.000 revenue per year. Not 0 USD, not USD 50.000, but only USD 5.000. Yes, that is the Embercadero that I knew. Probably this 'free' edition is canceled next year. Would not be the first time...
Edit: yes, still only runs on Windows
However, keep in mind that desktop apps have the major disadvantage of figuring out distribution (separately for each platform!!), which includes the following two steps: 1) packaging the application in some format (e.g. an MSI installer for Windows and a Disk Image Bundle for macOS), and 2) distributing that package (including auto-updates). I have written a number of articles about this topic, see https://www.augmentedmind.de/2021/05/30/distributing-windows... and https://www.augmentedmind.de/2021/06/13/distributing-macos-a... . You get rid of all that if you just built a PWA or other kind of web app.
In addition, if you use Python, you also need to choose a "freezing" solution, such as PyInstaller (more details at https://www.augmentedmind.de/2021/05/16/distribute-python-ap... ).
Their roadmap include, in some years I suspect, probably 5, to also target WASM at which point, if Embarcadero is smart enough to lower their ridiculous license pricing to under $300, will become the most powerful tool to write cross-platform applications.