Fork me on GitHub
#announcements
<
2022-08-12
>
Matthew Molloy05:08:14

Hi team, Has anyone here tried https://htmx.org? Its a great and simple way to do server side rendering. I've written a Clojure backend https://whamtet.github.io/ctmx/ that provides a react (or Clojure reagent) like UI style. It feels a lot like writing frontend Clojurescript except you are on backend JVM and have super fast load times - no JS! Ctmx provides a defcomponent macro which is almost the same as defn except it stores symbol references in the metadata. You expose an endpoint with make-routes which recursively exposes all subcomponents and ties in seamlessly with the overlying htmx. This novel approach also opens up other possibilities. For example we maintain a call stack of components which we can use to auto-name fields. The autogenerated names can then reconstruct complex forms as JSON which always updates to match the UI of the form. It just makes web development so simple. There is a simple template available with luminus lein new luminus my-project +ctmx. Update project.clj to ctmx 1.4.5 and then hit lein run. The above link shows some samples of how to work ctmx, I'd love feedback, suggestions for improvement etc.

👍 12
🆒 3
rickheere06:08:18

I use it in a clojure and nodes project. I got inspired to do so by reading the docs of https://biffweb.com/

👍 3
Eugen08:08:32

I'm exploring it and porting a htmx calendar to clojure ctmx https://github.com/ieugen/jlp/ .

Eugen12:08:06

what about it @U02N27RK69K? @U02AM852K5F is whamtet on gh . He made a new release and was asking for feedback / usage of ctmx

Cora (she/her)12:08:11

whoops my bad I misread

Eugen12:08:59

no harm done 🙂

enn13:08:20

I’ve been intrigued by HTMX for a while, thanks for sharing this! Looks cool.

Eugen13:08:27

yes. I am impressed. try it out, see for yourself

myguidingstar23:08:56

that's great. What's the story for anti csrf attacks? I don't see that mentioned

Matthew Molloy01:08:57

You can just add it as middleware. If you are asking about ctmx then it just converts UI components into reitit routes. You can wrap that in middleware for authentication, csrf etc.

Rupert (All Street)11:08:56

We've been using HTMX at All Street - it's been fantastic for us. It embeds nicely inside of Hiccup pure data structures.

Casey12:11:44

@U02AM852K5F If we have some ctmx related questions (that aren't really bugs so not suitable for a GH issue), do you have a channel here we could ask in?

grzm20:08:47

Hi! I scratched an itch and released a https://www.rfc-editor.org/rfc/rfc6570 library: https://github.com/grzm/uri-template There are a couple others already out there. This one uses https://github.com/cognitect-labs/anomalies instead of throwing exceptions, and returns detailed parse information in the event of an error.

🎉 12
curly_brace 1
rickmoynihan08:08:39

There’s also another clojure one here that a colleague of mine wrote a few years back here: https://github.com/lkitching/clj-templates He’s not much of a self publicist and never even added a README, but it’s pretty solid, well tested and easy enough to use.