Search code examples
clojureleiningencompojureringluminus

What's the relationship between Leiningen, Compojure, Luminus and Ring?


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?


Solution

  • 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.