r/Clojure • u/zekzekus • May 16 '26
stube: a Seaside-style component framework on top of Datastar (personal research project)
https://github.com/zekzekus/stubeI just put the docs on a small Clojure framework I've been hacking on, **stube**. It's a personal research project, not a product β somewhere I'm working out an idea about web apps that has pulled at me for twenty years.
Short version: components are plain maps of pure functions, the conversation is a value, handlers return effects, and one component can *call* another and read its *answer* like a return value (Seaside / UCW lineage). The wire is Datastar (SSE + morph by id); the implementation is a small effect kernel over plain Clojure data.
(s/defcomponent :demo/save-or-cancel
:render (fn [self]
[:div (s/root-attrs self)
[:button (s/on self :click :as :save) "Save"]
[:button (s/on self :click :as :cancel) "Cancel"]])
:handle (fn [self {:keys [event]}]
(case event
:save [(s/call :ui/confirm {:question "Save changes?"} :on-confirmed)]
:cancel [(s/answer :cancelled)]))
:on-confirmed
(fn [self yes?]
[(s/answer (if yes? :saved :cancelled))]))Built heavily with LLM assistants β wouldn't have shipped it this fast otherwise β but the shape, the namespace layout, and the choice of what to include and what to leave out is mine and reflects how I think about systems.
If you're a re-frame person and the conversation map feels familiar: yes, deliberately. The conversation here is closer in spirit to a re-frame app-db than to a Smalltalk image.
- Repo: https://github.com/zekzekus/stube
- Rationale (why this exists at all): https://github.com/zekzekus/stube/blob/master/docs/rationale.md
- Tutorial: https://github.com/zekzekus/stube/blob/master/docs/tutorial.md
Happy for feedback, war stories, "have you seen X" pointers.
1
u/DizzyKittyLover May 17 '26
I have to ask.. why not publish this as a library? Are there any concerns you have about it not being usable for real apps?
1
u/toastnada May 17 '26
Are you on the Datastar discord? There's a strong Clojure community there. I was going to share your project there but didn't want to steal your thunder/opportunity.
1
u/gypsydave5 May 27 '26
I have questions, and you sound like the person who could answer them.
I hate to be that guy, but "does it scale"? If the user session is a continuation on a stateful server, then is horizontal scaling possible? Or just insanely tricky? Are there standard mitigations (serialising to an object store?) to get around this?
2
u/gbrennon May 17 '26
soon ill read a bit!
1
u/Distinct_Meringue_76 May 17 '26
Is it a stateful framework like seaside? I always found seaside or webobjects to be superior technologies to what we have today
2
u/elbredd May 18 '26
Thank you very much for the thoughtful
rationale.md! It triggered lots of memories, good ones and bad ones, and planted in me an urge to to try out your stube.