I'm starting my new learning phase of Clojure. I want to build a web application, but I don't know which one to use. I've searched for several hours online, and all the things I found kind of overlap each other and I'm a little bit confused by that.
I have experience in ASP.NET MVC and JavaEE, so if there's something to relate Clojure web programming with those experiences, I'm glad to hear about it.
What's the relationship between Leiningen, Compojure, Luminus and Ring?
Leiningen is a build tool. Something like Maven in Java world (in fact, it uses Maven under the hoods). You define dependencies and configurations in project.clj
, and then run nice Leiningen commands to download dependencies, compile you code, run your application and much more.
Ring is a basic web framework. You can compare it to Servlets in JavaEE. It provides basic functionality for handling requests, but isn't very high level or full of features. In particular, it requires you to write route dispatching yourself.
And if you don't want to mess up with routing, just use Compojure. As it states on its GitHub page, "Compojure is a small routing library for Ring that allows web applications to be composed of small, independent parts". If you need comparison with Java worlds, I think Spring MVC quite close is analogue.
I haven't heard about Luminus before, but it seems like it's trying to replace Noir (which is deprecated now). Both Luminus and Noir are built on top of Ring and Compojure and further extend Compojure functionality.
Leiningen is a build tool optimised for Clojure development. It interacts mainly with Maven repos. You can for example generate pom.xml file from your project.clj
Ring is low level API for web application development. For example, it uses maps data structures to wrap request and response. And of course, it providers handlers, middle wares and other important artifacts.
Compojure provides an elegant routing library. Most of time, it is used with Ring.
Luminus is a collection of many Clojure libraries to help you start developing web applications in Clojure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With