top | item 43938309

Show HN: A backend agnostic Ruby framework for building reactive desktop apps

92 points| zero-st4rs | 9 months ago |codeberg.org

For a year or two I've been building a UI library with the aim of making desktop applications fun and easy to write.

It is currently written in C/Ruby and uses a custom tree sitter grammar to describe templates.

Features include: composable UI components, template directives, event and prop handling, slots, styles and automation capabilities baked in.

One of the goals of the project is privileging easy to write custom components via a drawing API over providing a fixed set of components.

At the time of this writing it should install on Windows, Mac, and Linux, but sometimes it is hard to test the install on all platforms.

I'd love to hear any feedback or suggestions on the project. It is still in an early stage, but it would be great to hear thoughts.

Docs are here: https://hokusai.skinnyjames.net/ Repo is here: https://codeberg.org/skinnyjames/hokusai

Licensed under the PPL

34 comments

order

viraptor|9 months ago

Could you add some information about licence? Currently I don't know what is it compatible with and it's not listed on OSI. So unless someone's up for reading lots of legalese, it's not easy to use/publish.

omneity|9 months ago

This is reminding me a lot of shoes.rb (in a good way)

Awesome work!

zero-st4rs|9 months ago

Thanks! _why is the person who really sparked my love and engagement with Ruby so this means a lot.

xfalcox|9 months ago

This looks super cool, exactly what I've been wanting to create some useful widgets! Thanks for sharing!

zero-st4rs|9 months ago

Thanks! I'm really interested to hear how it "plays" for people. Would love updates if you use it.

jenadine|9 months ago

First time I hear about "copyfarleft license".

I wonder what that means in practice for such a library.

az09mugen|9 months ago

Very cool project, and well thought with the choice of Raylib or SDL2. But since Raylib can compile to Android (https://github.com/raysan5/raylib/blob/master/examples/Makef...), do you think it could be difficult to add Android as a target platform ?

zero-st4rs|9 months ago

Interesting, for sure. I don't know much about Ruby on android (the resulting application will absolutely need a ruby interpreter) but I thought Windows would be a no-op and I got it working there, so who knows? :)

whalesalad|9 months ago

How would you compare this to RubyMotion?

zero-st4rs|9 months ago

Great question. From what I understand of RubyMotion, it compiles directly to native, calling into Objective C APIs, and like DragonRuby the Ruby implementation is not MRI.

Since Hokusai uses MRI, one can pull in from that ecosystem of gems.

RubyMotion also appears to support (iOS, Android, OSX) whereas Hokusai intends to support OSX, Linux, and Windows.

Implementation-wise, the framework itself seems different. Looking at the following [RubyMotion app](https://github.com/HipByte/RubyMotionSamples/tree/master/ios...), the logic is spread out over separate files and it doesn't appear to have a templating language.

On the other hand, Hokusai UI components are just a class that inherits from Hokusai::Block, and are self contained blocks that can be stitched together.

Hokusai is more like Vue Single file components in this regard. Hokusai also doesn't make a distinction between a "component" and an "app", they are all just Blocks.

Does that answer your question?

zem|9 months ago

looks neat, and definitely in the spiritual tradition of shoes! how does deployment work? can this be used to ship apps where the end user doesn't need to be aware of hokusai or ruby?

zero-st4rs|9 months ago

This is a great question that I don't yet have an answer for.

Ideally, there should be an automated way builtin to the gem that packages apps.

Currently, I use a tool I wrote called Barista to package an an application with it's dependencies, (part of it was modeled after chef/omnibus). This might not be the best way though, so I'm open to ideas.

dismalaf|9 months ago

Looks really cool. Just a curiosity though, why xmake instead of rake?

zero-st4rs|9 months ago

Good question! Most of the development build fetches and compiles C dependencies. xmake happens to be really good at this, especially considering xmake-repo.

Rake tasks don't have builtins for this iirc.

iraliaf|9 months ago

this is really cool, thanks for contributing to the ruby ecosystem!! Do you have any example sites? I couldn't find a reference on your overview

samiv|9 months ago

Cool.. I guess but I just wonder.. is writing the UIs in code an actual practice that people do these days?

I program (mostly) in C++ using Qt for my UIs and I just use the Qt Designer to visually drag and drop to build my UIs and the actual code gets generated by the tool.

Fast and simple.

sunrunner|9 months ago

As an end user, what's the licensing situation like with Qt? I was looking to build a cross-platform desktop application (down the rabbit hole...) and was frustrated with the number of options that were just a web view of some sort and some bindings to a JS/TS framework of your choice (I don't have one and don't really want to have to use one or bundle it with the application).

Qt looked interesting, particularly with the concise syntax afforted by QML and QtQuick, but the licensing was off-putting and even just getting access (for a non-commercial project for example) seemed to require an awkward sign-up and some kind of installer.

I crave the conciseness and simplicity of something like SwiftUI but the options for doing that in a cross-platform way seem limited.

Klonoar|9 months ago

Almost everywhere and everything I’ve worked on that had a UI layer has eventually - if it didn’t start there - landed on just managing the UI in code itself.

teaearlgraycold|9 months ago

Most UIs are made with web technologies without WYSIWYG. And now quite a lot of UIs on desktop are made with web tech.

zero-st4rs|9 months ago

Pretty cool! I've heard a lot of good things about Qt.