Backend with Clojure (JVM) vs ClojureScript (v8)

I’m strongly considering using Clojure for a new project. I know that historically people used Clojure on the JVM for the backend and then ClojureScript was just intended for the front-end. But now that Node has such widespread support and ClojureScript can be used on the backend (particularly with Shadow CLJS), what are the pros and cons of a backend with Clojure/JVM vs ClojureScript/Node?

As I’m new to the environment, I’d prefer to avoid the extra complexity of also learning the JVM. It would be nice to run javascript and one set of tools (bundler, node, yarn, etc) for the whole stack. But I don’t want to make life harder on myself if I’m really going to be swimming upstream. How mature is a ClojureScript/Node backend?

Thanks!

Some people do use a ClojureScript + Node backend, but you’ll find a lot less info about it online, and not a lot of people who can answer your questions.

I think there’s more people going with a ClojureScript + Node serverless setup (like on AWS Lambda), then there are going with a server setup, so you could consider that, since I think you’ll find more info on it.

The smaller number of people doing it, also means less ClojureScript libraries to choose from for that use case, though you’d have access to all the Node stuff, so that might not be an issue for you. I do know of this: https://macchiato-framework.github.io/

Otherwise, the biggest downside I can think of is mostly that ClojureScript has more limitations compared to Clojure JVM, it isn’t as dynamic, so having a REPL in it, defining macros, using runtime eval and all that is a lot more difficult to do, and requires more shenanigans to get working.

And there’s just Node vs JVM, but I’ll let you have your opinion on that. The biggest difference is that the JVM can do multi-threading and has better single-threaded performance, while Node has a simpler model for async IO.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.