9 ms·
Electrobun: Cross-platform desktop applications written in TypeScript
- sshine 2y agoHow do they manage the OS-specific stuff with pure TypeScript? How does it compare in benchmarks against Tauri for size and speed?
- semireg 2y agoA: native bindings written in zig
- c0wb0yc0d3r 2y agoI dug through it a tiny bit because I was curious as well. To me it looks like OS-specifics aren't dealt with in the project. It uses bun to run the TypeScript. From the getting started docs the project just opens a browser window for the UI. I didn't look to see if this meant the user's default browser or a bundled browser.
- yoav 2y agoNative bindings written in c/objc and a zig binary that bun spawns.
- mdaniel 2y agoBold choice: https://electrobun.dev/docs/guides/Compatability#:~:text=No%20near-term%20plans%20to%20support%20building%20on%20other%20platforms https://electrobun.dev/docs/guides/Compatability#:~:text=No%... (that text appears right next to "macOS (arm)") Given that, I was curious how their workflows folder looked but, well, that answers that question: https://github.com/blackboardsh/electrobun/tree/9ce4ed636100f89bc1dd59632d965f6c8a8107bb/.github https://github.com/blackboardsh/electrobun/tree/9ce4ed636100...
- yoav 2y agoIt’s still early and it’s just me working on it so I’m trying to get to stability and then building for (distribute apps to) windows and linux before making all the cli stuff work to let you dev on other OSes. So “no immediate plans” means check back next year after the 1.0.0 release
- thayne 2y agoWhat does "not supported" mean? Does it mean "you can probably get this to work, but it's not my OS so I won't go out of my way to help you" or "the build process depends on something only available on macs"? There isn't an obvious reason it wouldn't be possible to build on linux or WSL at least on windows.
- bearjaws 2y agoNot supporting arm is dead on arrival for anyone looking to build cross platform...
- sschueller 2y agoIt's the other way around, they only support arm at the moment: https://github.com/blackboardsh/electrobun/issues/10#issuecomment-2318428668 https://github.com/blackboardsh/electrobun/issues/10#issueco...
- bearjaws 2y agoAh that is confusing. Well, that still suffers the same problem, just in the other direction.
- marionauta 2y agoThe current version is 0.0.13 (on the homepage), it's normal that the author is focusing on their platform at the moment. It probably was too son to post it on here.
- progforlyfe 2y agoFunny spelling error there, too. Should be "Compatibility".
- deleted 2y ago[deleted]
- veidr 2y agoSo this aspires to be something like Tauri, but with Zig for the fast/native bits, and leaning harder on and more opinionated about the frontend/UI part? That's a pretty interesting proposal, but also a staggeringly huge amount of work.
- yoav 2y agoIt’s only been a few months but yes it’s a huge undertaking. I’m only picking up steam though and my whole career has been taking on these kinds of huge projects so it’s just getting started.
- veidr 2y agoAwesome. :) Good luck. I think it's a really attractive package for an early-stage one-person project. Nice docs, and cute bunny. FWIW, it also seems super-sensible to focus on Mac only for now, and get the basics working well there — a good Mac DX could provide the traction/momentum to get more contributors to help build out the obvious cross-platform promise.
- klabb3 2y ago> it also seems super-sensible to focus on Mac only for now I’m the first guy to agree to reduced scope, but unfortunately the reality of cross platform is that the subtle details affect the APIs, and once you add more platforms, you can realize issues too late. As a simple example, MacOS has a concept of “showing/activating the app” whereas Windows has… well individual windows. They add up, especially if you add mobile to the mix. I think the most sensible is to keep the api surface small, and also to peek at electron, tauri etc to learn and try not making expensive mistakes.
- brailsafe 2y agoYa, I kind of hate to say it, but it feels like because of Window's backwards compatibility and variation in UI styles over the years, people expect Mac apps to be comparatively pretty consistent, and consistently good. There's some wiggle room, but usually it's some niche open source app that's just too generally useful to prioritize mac
- bobajeff 2y ago>Security and Performance with isolation between the main and webview processes That's one of the performance characteristics I'm afraid will hinder certain applications. It sounds like you need to use a IPC bridge to share data between the main process and renderor. Which means copying all the shared data. Like if I wanted to use ffmpeg for decoding video then each frame I'm waiting for a the decoded image to be copied before rendering it.
- afavour 2y agoEh, it’ll hinder certain applications but very few, really. Assuming the webview is intended for UI and very little else.
- yoav 2y agoOriginally I had it going via browser -> postmessage -> zig -> bun via named pipes and then bun -> zig via named pipe -> js via evaluate js. I’m building https://colab.sh/ https://colab.sh/ with electrobun and that rpc was pretty slow when trying to load multi MB files in the code editor. Last week I added an encrypted socket rpc option directly between bun and browser. Loading a 2MB file went from a few seconds to 400ms. I made it so that in contexts where CORS allows it automatically upgrades to the socket based faster RPC. That’s via RPC though. electrobun also exposes a custom views:// scheme in the browser context that can load files directly from specific sandboxed places in the file system. More to improve there but for a very big file you’d be better off writing it to the file system that would be much faster.
- thot_experiment 2y agoSure but "fast communication" is always going to be prohibitively slow if you are used to "reading the same chunk of memory". I don't really think that's an issue for the kinds of apps people use this sort of thing for and at first blush the IPC model here is at least better than Electron which is an absolute trash fire.
- dmazzoni 2y agoI'm a fan of more frameworks for desktop apps that wrap system webview rather than embedding Chromium. Chromium is awesome and all, but it's just way overkill for many apps, and doesn't make sense for the download size and the need to support auto-update for security features.
- hresvelgr 2y agoI feel the reason the system web-view is eschewed in these frameworks is because you have no choice but to maintain compatibility with 3-4 browsers: Edge/IE on Windows, Safari on Mac, and Firefox on Linux (usually).
- yoav 2y agoThe number 1 request I get from people is to add the ability to optionally bundle chromium. I personally prefer the system webview because you don’t have to rush update your app for every chromium security update. And on the web making things cross browser is a normal part of the job and instinct imo. But there are a ton of early startups that only have bandwidth to support chrome/chromium in their complex webapps and want a quick way to port their web app to desktop app. For them taking on the security burden and increasing bundle size is a good tradeoff to getting that consistency. Luckily electrobun has a custom zig bsdiff implementation that generates update diffs as small as 4KB and self extracting executable that uses zstd so at least the file size is less relevant of a concern compared to electron.
- lolinder 2y ago> you don’t have to rush update your app for every chromium security update I'm interested to hear more about this—if you're using security-sensitive features in a WebView, aren't you then at the mercy of the OS to patch them whenever they see fit? And if you're not using features that have security implications, why do you need the latest version of Chromium at all times?
- littlestymaar 2y ago> But there are a ton of early startups that only have bandwidth to support chrome/chromium in their complex webapps and want a quick way to port their web app to desktop app. Ugh! People writing web apps without supporting anything else than Chrome should burn in hell. (And that's a pretty useless decision anyway since “supporting chrome” really means supporting two engines: Chromium and WebKit, because Chrome on iOS uses WebKit internally …)
- Carrok 2y agoWhy do so many projects fail to include any screenshots at all? Maybe the authors don't think it's necessary, but step 3 under `Getting Started` is called `Creating UI`. Why would they not show what the result of the tutorial looks like?
- Ringz 2y agoNot only are screenshots often missing, but I’m also surprised by how many projects fail to describe the purpose and goals of their project in short, simple sentences. Many mistakenly assume that only users and developers visit the website or repository, not decision-makers. More ELI5 ("Explain Like I'm 5") can never hurt.
- majkinetor 2y agoWriting good documentation is extremely hard. Even 10x engeneers can be basically illiterate.
- metalliqaz 2y ago> Even 10x engeneers can be basically illiterate. I see what you did there
- TripleChecker 2y agoThere's certainly a persistent issue of typos: (34 here that we found: https://triplechecker.com/s/689196/electrobun.dev https://triplechecker.com/s/689196/electrobun.dev).
- xixixao 2y agoScreenshots are harder to produce, maintain and publish. I also suspect many technical authors are less “visual” so to speak, putting less emphasis on visual presentation.
- jamager 2y ago
- throwaway888abc 2y ago"...and cross-platform desktop applications" the homepage says But, Sadly, this is mac only[0] no windows or linux ? Do I understand it correctly ? [0] https://electrobun.dev/docs/guides/Compatability https://electrobun.dev/docs/guides/Compatability
- auggierose 2y agoAdd what about macOS (intel)?
- prophesi 2y agoHere's their roadmap[0], that's later down the road as well (v0.4.0). [0] https://github.com/blackboardsh/electrobun/issues/2 https://github.com/blackboardsh/electrobun/issues/2
- NoahKAndrews 2y agoLooks like they're planning to only ever support building on Mac, but they plan to support running on Windows and Linux in the future
- jclulow 2y agoWild that one would pick the only platform with a rubbish VMs and CI story as the OS to use for building software!
- ramon156 2y agoIf the worst case works, the best case will follow I suppose :P
- veidr 2y agoWhat's wild about it? It's one person, and they probably mainly use a Mac. If they used Windows, it would be Windows-only at this stage. I have lots of projects that only run on Linux. Clearly, if the project succeeds and gains tractions, the other platforms will come.
- kookamamie 2y ago> Ship updates to your users that are tiny What about the users that are medium or large?
- fbn79 2y agoI'm quite sure is talking about "low size update packages"
- user_7832 2y agoPretty sure it was a joke on the language used ;)
- Cruncharoo 2y agoYou’re gonna need a bigger boat
- deleted 2y ago[deleted]
- schneehertz 2y agoBasically, this is an Electron that replaces Node.js with Bun and Chromium with WebView?
- rounce 2y agoIt seems it bundles Chromium
- kevlened 2y agoIt doesn't yet. "Use the built-in system Webview (or bundle a 3rd party webview like Chromium: coming soon...)" https://electrobun.dev/docs/guides/Getting%20Started/What%20is%20Electrobun#flexible https://electrobun.dev/docs/guides/Getting%20Started/What%20...
- rounce 2y agoThanks, I stand corrected.
- surfmike 2y agoWhich webview does it use?
- deleted 2y ago[deleted]
- Culonavirus 2y ago[flagged]
- bitsandboots 2y agoAs an alternative to electron, using bun as a base sounds nice. But being better than electron is a low bar when it's the source of the laziest, most bloated programs on my system. Also, still waiting for bun to work on freebsd. Patiently! But it's on my xmas wishlist :)
- yard2010 2y agoYoav, you are a genius. Keep up the good work.
- alkonaut 2y agoSo it's a kind of electron apps, packaged for Arm Mac only? Hate to be that guy but that's the least cross platform thing I could imagine. I mean Windows Forms apps and VB6 apps are more cross platform than that (at least supporting one OS but a couple of architectures).
- jopicornell 2y agoWell, it's not like VB6, which never had compatibility on any other OS. They are starting out and they are confortable with that small scope, which I think is good for projects like this. They have Windows and Linux suport on their roadmap.
- peutetre 2y ago> it's not like VB6, which never had compatibility on any other OS Just when you thought it was safe to go back in the water... VB6: The Revenge - https://bandysc.github.io/AvaloniaVisualBasic6/ https://bandysc.github.io/AvaloniaVisualBasic6/
- alkonaut 2y agoI was considering 16/32/64bit versions of windows as being several platforms while arm-only MacOS is a single one. It's good they have cross platform on the roadmap. Perhaps it was just unfortunate that the first thing in the headline was "Cross-platform" when that really isn't the main selling point.
- deleted 2y ago[deleted]
- wilgertvelinga 2y agoIs there anything Electrobun does to prevent XSS vulnerabilities? The docs actively promote setting .innerHTML, without any warning regarding concatenating user input.
- cxr 2y agoWhat can it do? The only thing that prevents that is the programmer knowing what kinds of inputs they're dealing with and making sure unsafe input is properly escaped into safe input when the context calls for escaped input. There's no getting around this.
- dboreham 2y agoNever understood why these things aren't done by running a local http server and use a regular browser.
- whizzter 2y agoDeveloping for Electron you usually had a regular webpack server in the background to handle hot-reload cases and technically you could have a regular browser. In production however you don't want a browser for 2 reasons, first should a local app really expose internals to the network(And get mucked up by firewalls)? secondly the deployment is easier the more it's self-contained. Also since there are internal communication channels between "browser" and native/"server" parts (that are far faster than going over the network) you don't want to diverge the production and development environment to avoid having hard to debug things. On top of it, in this case bun is also a bundler so you get the typescript transpilation for free. So to summarize, if your app is really only a plain webapp distributed to desktop then sure you can developer everything with a local webserver and package with whatever is available, but as soon as you involve native off-browser parts you don't want to start exposing everything and using the embedding systems(be it electron or webview2/khtml,etc) built in browser<->native communication is simply the saner choice and the point of these projects is to abstract that from the developer.
- dymk 2y agoLocal file system access is one reason, any other native APIs needed for making a desktop app, etc
- PittleyDunkin 2y agoAny plan for supporting native toolkit access ala react-native, or is the plan to just rely on web tech?
- c-smile 2y agoYou can use my Sciter if you need native widgets. Sciter is an HTML/CSS/JS engine with the ability to attach native widgets to DOM elements. So you'll benefit from two worlds: HTML/CSS layout richness and native widgets. The major problem though is Linux family of OSes in this respect. I have version of Sciter that works directly on X11 or Wayland ( https://sciter.com/sciter-glx-generation-4/ https://sciter.com/sciter-glx-generation-4/ ). Windows and MacOS have clear concept of child windows/widgets but no such things on X11 or Wayland realistically speaking. So react-native is practically iOS/Android only thing.
- PittleyDunkin 2y agoFWIW, I was pretty impressed with react-native for mac os: https://github.com/microsoft/react-native-macos https://github.com/microsoft/react-native-macos Granted, it doesn't have the same support or attention or community that react-native for iOS does. But it was certainly a refreshing way to build a native app. I think some of the shine has come off it now that a lot of the ideas have been adopted into SwiftUI.
- yr5teoes7s 2y agoI300$
- ivanjermakov 2y agoWhat rendering engine does it use? Project name suggests Electron, but they never mention it > The current Electrobun Playground app is 50.4MB in size (most of this is the bun runtime) Seems to be more than just bun runtime.
- klabb3 2y agoElectron is not a rendering engine. It’s an application bundler, which itself bundles Chromium and NodeJS. This project uses native web views, like Tauri. They wrote that they might provide the option of bundling your own engine, ie like Electron, which I personally think it’s a bad idea. Tauri proved that you don’t need it. But now that you mention it, agreed that 50MB is a lot.. maybe just standard JS dep bloat? That could be clarified.
- Wytwwww 2y ago> Tauri proved that you don’t need it Are there any major cross-platform apps based on it?
- klabb3 2y agoLast I checked they did a pretty bad job showcasing the apps. But search for “awesome-tauri”, it’s pretty standard these days. Way past the initial hipster phase, almost boring. A bit of self promo: you can also check out https://payload.app/ https://payload.app/ which is the project I’ve been working on for way too long now.
- yoav 2y agoHey hn! Author here: Thanks to whoever submitted. Electrobun is in the very early stages. The roadmap is a bit out of date. Here are some highlights: - it’s like Tauri in that it uses the system webview and does not bundle chromium - it’s like Electron in that it bundles Bun instead of Node for the main process so you just write typescript for both the main and browser contexts - native bindings written in c/objc with a zig wrapper that the bun process runs - it will be cross platform, but working on stability first - the cli handles updates code signing and everything else you need and outputs build artifacts that you just need to upload to S3 or any static file host. - it has a custom optimized bsdiff implementation in zig that autogenerates updates for your app as small as 4KB - it has a custom zig self extracting mechanism that uses zstd so your initial download is also as small as can be. - it has a custom encrypted easy to use RPC mechanism between bun and browser processes where you just write method signatures and handlers. - it has a custom OOPIF implementation so you can embed isolated browser contexts with your html <electrobun-webview> element that are performant and easy to use so you could build a multi tab web browser with it if you wanted.
- pmuk 2y agoDo you have any examples apps built on electrobun?
- yoav 2y agohttps://www.eggbun.sh/ https://www.eggbun.sh/ is built with Electrobun.
- bsimpson 2y ago[flagged]
- joshmanders 2y ago> You should pick a different name. Can we please stop telling people to change their names because something else exists with a similar name? If we take this stance seriously, then Google would have to change their name as San Diego Colab has existed for a year before Jupyter was created, therefore existed before Google Colab.
- barbequeer 2y agoI love to see projects like this, the more alternatives we have for creating cross-platform apps, the better.
- jedisct1 2y agoVery promising project!
- niutech 2y agoSo is it a yet another webview-based framework like NeutralinoJS (https://neutralino.js.org https://neutralino.js.org), Electrino (https://github.com/pojala/electrino https://github.com/pojala/electrino) or DeskGap (https://deskgap.com https://deskgap.com)? What's their advantage apart from using Bun instead of Node? For relly lightweight cross-platform desktop apps better use a non-webview-based native framework like Qt, GTK, wxWidgets or even recently released FLTK 1.4.
- rubymamis 2y agoCouldn't agree more, QML with C++ for the logic (or Rust or whatever other bindings you want to use), is the best imo.
- Tmpod 2y agoIf you want to use Rust, Slint[0] may be something to consider, seeing as the existing bindings for Qt and QML are not very pleasing to use (mostly talking about qmetaobject-rs and cxx-qt). If I'm not mistaken, Slint is developed by ex-QML people. [0]: https://slint.dev https://slint.dev
- yayoohooyahoo 2y agoModern apps these days often end up needing to render complex layouts and rich text, so you end up needing QWebview anyway. At least that's been my experience creating desktop apps lately.
- golanggeek 2y agoAny similar platforms using Golang?
- jrop 2y agoWails, if I'm not mistaken: https://wails.io/ https://wails.io/
- AlfredBarnes 2y agoInteresting to watch it grow. I'm not going to jump in right away, but this is a great project!
- KameltoeLLM 2y ago[flagged]
- pluc 2y agoI would've gone for Node++ or Node#
- kelvinjps10 2y agoThe other time I was thinking why this hasn't been done, here it is
- deleted 2y ago[deleted]
- zephraph 2y agoThis is awesome! I built a similar tool as an experiment while at Recurse: https://github.com/zephraph/webview https://github.com/zephraph/webview. Didn’t really do any heavy lifting though, just reused some of Tauri’s crates. Does Bun run on the same process as the GUI binding? OSX steals the main thread when rendering a native window which made me lean towards separating the processes. Still wonder if there’s a better way.
- yoav 2y agoI’m using bun for the main process. Bun runs a zig binary which can call objc/c methods. So the “main native application thread” is technically the zig process. Then there’s all kinds of fancy rpc between bun and zig and between bun and browser contexts.
- zephraph 2y agoAh, cool, that’s essentially what I’m doing too. Rust binary does the system interactions. I’m just using a pretty simple json RPC over stdio though.
- cageface 2y agoOne of my favorite things about Tauri is that I can write all the "back end" code in Rust. I think this has a lot of advantages for performance and correctness. For that reason alone I'm more inclined to reach for it than Electron or something like this when I have options.
- thot_experiment 2y agoTangential but I hadn't heard of Bun before and their performance claims had me interested, sadly seems you just can't beat V8 in the real world. I threw some poorly optimized art code I wrote yesterday at it and it's almost 2x as slow as when I run the same code in node.
- hiccuphippo 2y agoMost of the speed ups seem to be in optimizations to the native code and porting js libraries to it. I'd expect pure javascript code to not have much of a difference. 2x sounds like you hit some limitations of JavaScriptCore itself.