

Ask HN: Clojure best practice for web applications? - jacquesm

Does anybody here have experience building a web application using Clojure?<p>I would like to be able to set up a mysql driven web application using clojure as the language to build it in, but I don't know where to begin to look for the 'best of breed' components to do this with.<p>This is my first foray in to the big and scary world of functional programming, a trial project to be followed by a much larger one.<p>Any pointers in the right direction would be greatly appreciated.
======
tcrayford
Compojure is a good bet for clojure web applications.

To get you started, have a look at the source for clojars and briancarpers
cow-blog.

<http://github.com/ato/clojars-web> <http://github.com/briancarper/cow-blog>

Brian Carper has a load of information about using compojure on his site
(<http://briancarper.net>). In particular interest are:

compojure to the rescue: [http://briancarper.net/blog/clojure-and-compojure-
to-the-res...](http://briancarper.net/blog/clojure-and-compojure-to-the-
rescue-again)

deploying clojure sites <http://briancarper.net/blog/deploying-clojure-
websites>

------
Quiark
I wrote a website on Google App Engine using Clojure. I used compojure and
some Java library for OpenID. My database was (naturally) Google Datastore for
which I had a custom wrapper based on
<http://github.com/duelinmarkers/appengine-clj/tree/master>. I'm not giving
the link, because it's all in Czech, so it would be no use for you :)

It was a nice experience, functional programming fits well to website
programming (the response is a function of the request and data in the
database).

For debugging/development purposes I strongy recommend to reload the code on
each request using load-file. Restarting the server every time a change is
made is unbearable.

------
sunkencity
Use compojure and clojure commons. You might want to use leiningen too. It is
definately worth really checking out the clojure commons thoroughly before you
start looking for other software packages, you'll have something to judge them
against. For my own purpouses I've found the database bindings in commons good
enough, and there's tons of cool stuf in commons that I would like to play
with.

~~~
ericlavigne
I tried a Google search for clojure commons, and your post here was the third
result. Maybe you meant clojure contrib?

I wrote a small Compojure application about a week ago. It's only an
afternoon's worth of work, plus some cleaning up later, so should also be easy
for a newcomer to digest.

The source code is here: <http://github.com/ericlavigne/island-wari>

You can try out the application here: <http://ericlavigne.net:8054>

~~~
jacquesm
Very neat. Can I use your code to jump off from ?

~~~
ericlavigne
Do whatever you want with it. I hope you enjoy Clojure - I certainly have.

~~~
jacquesm
Ok, thank you very much, I will definitely credit you in whatever I derive
from it.

------
Rantenki
Two hours old (albeit on a Sunday), and the only thing in this post is the
sound of crickets chirping.

I have been learning Clojure, and the lack of responses is a bit of a
surprise.

Perhaps #clojure on freenode will get more responses?

------
jacquesm
thank you all! More reading to do :)

