Fork me on GitHub
Matthew Molloy05:08:14

Hi team, Has anyone here tried Its a great and simple way to do server side rendering. I've written a Clojure backend 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

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

👍 3

I'm exploring it and porting a htmx calendar to clojure ctmx .


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


no harm done 🙂


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


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


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.


@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?


Hi! I scratched an itch and released a library: There are a couple others already out there. This one uses instead of throwing exceptions, and returns detailed parse information in the event of an error.

🎉 12
curly_brace 1

There’s also another clojure one here that a colleague of mine wrote a few years back here: 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.