We just open sourced a new reactive server-rendered web framework for Clojure. https://github.com/dynamic-alpha/hyper - Please feel free to message me about it here or on GitHub
I'm unfamiliar with clj-reload - what is it?
https://github.com/tonsky/clj-reload --- a smarter way to properly reload namespaces when source files change.
But because it does it "properly", it subverts what hyper is doing.
Is it effectively restarting your hyper server?
ie. when it redefines the namespace that you have the server in, what happens?
I keep the server in an atom in a defonce, so that isn't affected. clj-reload deletes namespaces, then reloads them. Result: new Vars. This ensures that a lot of edge-effects in reloading are done correctly ... deleted Vars actually disappear, multi-methods and protocols are reloaded correctly, etc. But if you are adding a watch on a Var, that doesn't trigger because the Var is replaced, not modified.
I see
Well, in the readme I see ^:clj-reload/keep as an option? is that not viable?
I suppose the issue is the var doesn't change then, even if you keep it
It is, but would need to put that on virtually everything. I only looked at this for a few minutes last night, there's probably a way to make them work well together.
Yeah. So as a work around, I think you could define an atom and add it as a global watch to hyper, and then add a hook to the clj-reload to increment that atom
There might be something cleaner, but that probably will work quick and easy
(ns your.server)
(defonce reload-count* (atom 0))
^:clj-reload/keep
(def routes
[...])
(defonce server*
(atom (h/start! (h/create-handler #'routes {:watches [reload-count*]) {:port 3000}))
(defn after-ns-reload
[]
(swap! reload-count* inc))Something like that perhaps
Just created #hyper for anyone who finds this and wants to discuss hyper / needs help
It looks like there's a way to disable the unload behavior for an entire namespace, and I think that's what we want. I'll have time to experiment later.
I rewrote a smaller code base to be clj-reload-reloadable a while back.
My approach was:
1. Centralize all state in a single namespace, except that from being touched by clj-reload
2. Get hold of vars that may be unloaded with (resolve the-ns/the-sym)`.
Source is open, though interspersed with some Norwegian text.
State namespace (note clj-reload ns metadata): https://github.com/mikrobloggeriet/mikrobloggeriet.no/blob/3f8d0f9cc54084fedac24752ac635bcea9dfaaac/src/mblog/state.clj#L1
resolve injection: https://github.com/mikrobloggeriet/mikrobloggeriet.no/blob/3f8d0f9cc54084fedac24752ac635bcea9dfaaac/src/mblog/system.clj#L40
There are definitely lots of other approaches, but after these changes, clj-reloads have been reliable in this codebase.
I'm starting to look at hyper but the docs are .... sparse. Does your workflow include clj-reload? I've certainly seen a case where reloading source updates the web page immediately ... but only the first time? Do you haev a Discord or other preferred place to discuss?
Hey! Would love to improve docs if needed. If you redefine vars they should live reload for you - and it shouldn't be the first time only. We need to see about getting a channel here but you can DM me as needed too
I've found that reloading a namespace (not using clj-reload) does work, and updates the page, which is chef_kiss . When using clj-reload, its semantics are different, and you end up getting whole new Vars in the loaded namespace, which (I'm guessing, having not read the hyper code) gets in the way of hyper's reload logic.
I haven't been able to give it a test run yet - but a question I have is: if you don't diff changes and replace everything, then what happens when the user is typing in an input field which is updating state on every keystroke, will the user lose focus/position in the input?
Usually, there's throttling somewhere in the system. And morph keeps user focus and position. So that's non-problems in practice, but you have to think a bit differently from typical SPA architectures.
Morph + a signal can keeps focus. You can play with some demos probably a few bags haven't touched them in a while (for context these are both stress tests in that they morph 14000+ divs on each frame): http://cells.andersmurphy.com http://checkboxes.andersmurphy.com
Gotcha! Very cool demos btw.
Just another little example: https://github.com/Schroedingberg/tilda A booking system using datastar+xtdb - I haven't looked into whether this is architecturally similar to hyper, that'll be interesting
That potentially infinite amount of divs still makes me feel guilty at times 😅
Nice
Congratulations! I've been toying with a few of the same ideas, very interesting that you also landed on a "state stack" of global, session and tab. Doing the same for path parameters was an interesting addition I didn't think of!
Awesome stuff! Excited to see where you take this! 🎉
Thanks! I feel like a lot of us had all been imagining what it could look like since @andersmurphy's demo broke the web haha. Happy to have other peoples ideas and experience helping to shape it if you feel like getting involved @teodorlu
Yeah, the Clojure Datastar crowd has been a surge of innovation and helpfulness for the past year! I think many of us have sensed some potential, and desired higher-level tools than the SDK 🤘
Cool, good to see that I am not the only one tinkering with clojure+datastar 🥳
nREPL 1.6 is out with many small improvements! (details - https://github.com/nrepl/nrepl/blob/master/CHANGELOG.md#160-2026-02-26) We'll start rolling it out to CIDER user tomorrow. cider Outside of the code improvements, you'll probably (hopefully?) notice that the documentation has been polished in quite a few areas. I hope this will make it easier to find there what you're looking for - e.g. the meaning of life! 😉 P.S. We really need an nREPL emoji here! 😁
i posted in #spam-reports about an nrepl emoji
So nice! We're finally putting that beautiful logo to some good use! 😁
Hi folks, I am putting together a list of awesome LLM Clojure-focused libraries and projects: https://github.com/iwillig/awesome-clojure-llm. I hope other folks find this useful, and please reach out if you would like your project added there.
👁️ I will check your project out.
Thanks 🙏
hello iwillig. i am making an ergonomic llm library for my own tooling about exploring models. it's just my little garden shed, but if it fits please feel free to add it write up https://poyo.co/note/20260318T184012/ github https://github.com/minikomi/clj-llm • works well with babashka • backend agnostic api • malli based structured outputs