Mature Clojure web frameworks? [closed]

Perhaps my answer to the What is the good starting point to developing RESTful web service in Clojure? question on SO might be of help to you. It mentions some important web libraries for Clojure (with links and short summaries). The key point which I would like to reiterate here is stated in the first paragraph of that answer:

First of all, I think that you are unlikely to find a single shrinkwrapped solution to do all this in Clojure (except in the form of a Java library to be used through interop). What is becoming Clojure’s standard Web stack comprises a number of libraries which people mix and match in all sorts of ways (since they happily tend to be perfectly compatible).

To that I would add that you should probably not expect to handle things with the sort of “application flow” you might know from Java (or if you believe you really need it, you’ll probably have to roll your own lib to support it!). That’s alright, though, as people seem to be very happy with Ring’s handler-is-a-function, higher-order-middleware-friendly approach.


To address your bullets:

  • Response templating:
    There is a number of Clojure-specific solutions, including Enlive and Hiccup (Enlive is a very powerful HTML scraping / templating / transforming engine; Hiccup is a DSL for writing HTML in Clojure with the nice property that it renders fast). Also, this is probably one place where it makes perfect sense to drop down to Java and use something like, say, StringTemplate. This even has the good side of discouraging the mixing of templates and logic! (I believe Stuart Halloway has mentioned that Relevance — his company — is using this strategy in their work and having great success with it.)

  • HTTP sessions
    That would be Sandbar, I suppose. The author has started a series of blogposts about it which looks very promising.

  • REST with automatic mapping of URLs into action-functions and params
    That’s Ring & Compojure and/or Moustache. See below.

  • HTML forms (params available as map, error handling, validation)
    As above.

  • Application flow (known from Java frameworks – request handlers return action identifiers which are eventually handled by renderers)
    As mentioned above, not really something people tend to do in Clojure.


As a starting point in learning about the Clojure web stack, this Ring tutorial by Ring’s author Mark McGranaghan is very helpful. Compojure’s author James Reeves has some documentation on Compojure. Perhaps my recent answer to the What’s the “big idea” behind compojure routes? question might be of help too. Ring’s sources also include a great SPEC document.

Leave a Comment