5 ms·
Show HN: GUI apps in Node.js with smaller bineries
- graderjs 6y agoHello friends I'm excited to announce Grader.JS It's a little project I've been working on the last 3 weeks. It lets you build cross-platform desktop GUI apps using the power of Node.JS and HTML. It was motivated by the desire to have a way for me to build native binaries using my existing HTML skills. I looked at electron, and some frameworks like Qt, and Tauri (which uses Rust), but the main problems I encountered were: - Electron is full featured, but maybe too much so. Big binaries and Chromium inside each one. Too many APIs and they even need to fork Chromium so you don't have parity with latest browser features. - Tauri looks good. Simpler and produces miniscule and fast binaries, but I didn't want to learn a new language right now. I wanted to make something right now, and also feel confident that I'd be able to use all the HTML I already know. - I really like the idea of Qt, and experimented with the Node binding for it. But my main concern was the barrier to access that comprised of having a dedicated build set up for Qt, and also learning to think in its native GUI paradigm. I had a bit of a think and decided that: - I could use my existing knowledge of Chrome DevTools protocol to provide a sophisticated API that could scale to almost any use case, especially if combined with Node.JS - Many people already have Chrome installed so there was no need to bundle chromium inside my binary. And if it wasn't installed, I could download it once and then it could be used for all apps built this way. - I could use the '--app' flag for chrome to create a standalone GUI window with OS title bar, then use my existing knowledge of HTML to build a UI in that window. - I could package the code into binaries with nexe, and shrink those using upx. These realizations gave me the idea that I could create, with a bit of scaffolding and a bit of scripting a way for anybody to create a desktop binary using Node.JS and HTML, that was smaller than electron, and easier than Tauri or Qt. So i decided to turn it into an open source project. I looked around and many others have had this idea before. It's not that different to using the system webview, or even (a la Carlo) using Chrome. But Carlo was discontinued and I thought the API could be better, and using the system webview introduced integration complexity and limited hour I could use DevTools protocol to control it. I thought the approach i would take was simpler so i decided it was definitely worth the effort to have a tool with the API i wanted, that i understood (if not fully, as i would come to see during development!), and that i owned and could use how i liked. But development took me 3 times as long as i anticipated, because as i discovered, i didn't understand much about how Node worked at the intersection with the OS, and modules like child_process behaved slightly differently across platforms. So i had to work out those things to try to make everything as consistent and platforms as possible.
- purplecats 6y agoyou should include a screenshot
- graderjs 6y agoOk
- purplecats 6y agonice. i think this looks neat, specially if the binary sizes are small. if you wanted to make a paid option, you could consider hosting a server that can show you previews for how it looks like on various OSes