Hacker News new | ask | show | jobs
by Nihilartikel 1648 days ago
I came to the comments to make a similar assertion of Clojure(script) being fun. Usually I work in IntelliJ with Cursive. VSCode with calva isn't bad.

The stack for my project is:

Backend:

Redis (no relational DB needed for my use case)

Clojure:

Carmine - (redis interop)

Reitit - Nice API definition and routing

Malli - Nice schema validation and coercion

Timbre - Logging without known RCE vulnerability ;)

Frontend:

Clojurescript

Figwheel - CLJS compiling and hot-reloading in browser. Would probably use ShadowCLJS these days though.

Rum - It's a simple wrapper around react, with Hiccup-style list syntax for HTML. Though in a do-over I'd probably try Reagent since it seems to have a bigger ecosystem of wrapped react libraries, but I really like Rum best. That said, it's also not that hard to use native JS React components with Rum.

All of the libraries and idioms in this stack guide the design to push side effects out to the edges of the program - this makes testing easier in a lot of cases. E.g., for a web request you can craft a test request, or pretty-print a literal request object and paste it into your code, then pass it to your API in Reitit without an http-server attached, and get back the result object, and assert that it matches the desired output. Clojure's mutability make it pretty simple to stub or mock calls to storage, or to create a fixture to use a test database.

1 comments

Thank you! In the event you see this may I ask why not stick with Figwheel? Does ShadowCLJS do the job just as well? I remember Figwheel being impressive and it seems maintained.
Figwheel -has- been good for me, but my project is still using the even older figwheel (non-main) rewrite. There hasn't been enough pain to force an upgrade.

From reading and playing with a hello-world project, though, ShadowCLJS seems to offer roughly the same watch|build|hot-reload ability while also offering more and better NPM interop support. As it is now, I have some fairly ugly shell scripting around js packages and builds that could go away if I paid the effort to migrate to ShadowCLJS.

It would also be a lie to say that the generally positive buzz around it doesn't contribute.

If I might ask, what sort of project are you planning?