11

I want to build a website using Clojure...so: 1) which are the best libraries out there to do this at this time (summer 2011) 2) where are the best tutorials showing more than just a basic static "Hello World" webpage?

7 Answers 7

5

There's a web framework called Compojure you might look at. I've never used it personally, but this blog (by a frequent stack overflow contributer) seemed to have been written using it.

Sign up to request clarification or add additional context in comments.

Comments

5

The key library to learn and understand is Ring. Ring is the basis for all of the web "frameworks" in the Clojure toolkit, the most well-known being Compojure, Moustache, and Conjure.

Per the Ring readme, Ring "abstracts HTTP to allow modular and concise webapps". Translation: Ring lets you deal with HTTP requests and responses as simple Clojure maps and allows you to apply "middlewares" (functions that do things to those request/response maps) to add extra functionality like session handling, URL parameter handling, cookie handling, etc.

If you don't understand Ring, you won't understand what the other libraries do for you.

At the most basic level, Compojure and Moustache provide conveniences on top of Ring, specifically route handling and easier application of middleware functions. Beyond that, Compojure comes packed with a lot, while Moustache is more minimal framework. Conjure is a more Rails-like, full-blown framework that handles web app development at a similar level of abstraction as Rails (pre-built MVC architecture, schema help, etc.).

For a good overview of all the libraries in the Clojure web space, see this graphic: http://www.glenstampoultzis.net/blog/wp-content/uploads/2010/10/web-layers7.png

There's a lot there. At this point, folks seem to be bringing smaller libraries together as needed to write web apps, instead of relying on one bulky "killer" web framework that tries to be all things to all people.

Comments

4

1) imho the best (the most mentioned and elaborated) is Compojure + Ring

2) tutorials: simple: "Getting Started with Ring and Compojure" http://rob-rowe.blogspot.com/2011/03/getting-started-with-ring-and-compojure.html

more complex: "Building a Social Media site" http://www.bestinclass.dk/index.clj/2011/01/building-a-social-media-site.html

Comments

3

Noir is a Clojure web framework that's been released recently.

2 Comments

Seeing this on Hacker News inspired the question in part - is it a good web framework for Clojure?
This is just built on top of Compojure/Ring/Hiccup, it makes it easier to just get started. But as needed you can delve into those libraries if you need some more functionality that is not directly exposed.
2

Check out "A brief overview of the Clojure web stack", which is a wonderful guide to the current state of web-related Clojure libraries.

Comments

2

I recently switched from

(+ Clojure ring compojure hickup google-app-engine)

to

(+ clojure ring compojure enlive heroku)

Comments

1
  1. Intro to Clojure is one the video tutorials
  2. http://blip.tv/clojure has some screen casts, which will be helpful for you
  3. Learn Clojure
  4. http://www.learningclojure.com/2010/09/clojure-macro-tutorial-part-i-getting.html

1 Comment

it sounds like he already knows clojure. He's just asking about web frameworks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.