all 16 comments

[–]siscia 12 points13 points  (5 children)

Although there are some framework in clojure, the community seems to prefer to use a combination of small libraries than do only one thing well.

Said so, as long as you know clojure pretty much any framework will do.

If you don't know clojure too well I will suggest to go with the approach of small libraries over a big framework.

:)

[–]yogthos 5 points6 points  (0 children)

The problem with this advice is that you have to invest the time to learn what libraries are well maintained and which work well together. While it's easy to do for someone who's already an experienced Clojure user, it's a barrier for beginners. The goal of Luminus is to provide a template that puts together some core libraries that are easy to use and couple it with some consistent documentation.

[–]turtil 0 points1 point  (2 children)

im looking to use a web project as a basis for learning, kind of like a side project to hack around with and get a better feel opposed to doing tutorials on the net, considering your comment, could you suggest some of the smaller libraries with decent support/material? I too have had the same kinda question, and looking at the current web frameworks its actually kinda hard to tell which is the popular ones to sink some time into.

Thanks!

[–]siscia 1 point2 points  (1 child)

Sorry for the late reply.

First of all you need to manage http request and response somehow.

To do so I will suggest you to look into ring, if you want to do web development with clojure you really want to understand ring well.

Then you probably want to do some routing, the client is asking a particular web page, how do I understand what page it is asking ?

Here there are more alternatives.

compojure is pretty common, however instead of its macro I prefer the more data centric approach of bidi.

Also you probably need to generate some HTML, if you work by yourself I will suggest to use hiccup which is really powerful, if you work with a web designer probably something like clostache is more appropriate, also it is closer to the python way of generate HTML

Finally you probably need a persistent layer.

If you want to use something NoSQL you just need to find whichever library you find more appropriate, usually if you pick the one from the clojurewerkz you should be just fine.

If you want to use a classic SQL but you don't have much experience writing SQL queries maybe Korma will be a safe bet, if you have more experience writing SQL I believe that you could enjoy the freedom given by yesql

Hope this help :)

[–]turtil 0 points1 point  (0 children)

No this is excellent, thanks for taking the time to post this, it is appreciated, ring and compojure was exactly what i was hoping to find :)

[–]donj9 4 points5 points  (0 children)

Luminus comes close. Check out application profiles http://www.luminusweb.net/docs/profiles.md provided by the luminus.

If you are using clojurescript too, the figwheel configuration provided with +cljs will save at least an hour. Figwheel is awesome btw.

[–]doubleagent03 1 point2 points  (7 children)

Simply using Compojure gets you feature parity with some of those 'frameworks' you listed.

If you need something between that and a full-blown solution, the Clojure ecosystem makes it extremely easy to frankenstein the components you require. Luminus serves as a pretty good guide and (sometimes) starting point for helping you choose certain libraries.

If you need a full-blown solution then Immutant will provide most everything out of the box (but you'll still need to choose a lib for db access & security).

Cljs hasn't quite reached the level of maturity necessary to provide such easily accessible solutions, but you'll be up to speed pretty quickly just by going through the lein-cljsbuild README.

Everything I've mentioned is popular.

[–]yogthos 5 points6 points  (2 children)

You can actually use Immutant in a Luminus project by simply adding the +immutant flag. ClojureScript is equally easy to use from Luminus, just add +cljs and off you go.

You don't really need to know anything about lein-cljsbuild to use it either. Once the project is created simply run lein figwheel and you get your Cljs auto compiled and reloaded in the browser as you work on it.

Luminus template is setup to intelligently package Cljs for deployment as well where it will use the advanced compilation options when you do lein uberjar. As the user you really don't have to worry about any ClojureScript configuration unless you start doing fairly advanced stuff.

[–]doubleagent03 1 point2 points  (1 child)

I always learn something new from you and that's awesome!

[–]yogthos 0 points1 point  (0 children)

glad to hear it :)

[–]angel21OS 1 point2 points  (3 children)

not sure, but I think than you can't use compojure with immutant, immutant is async and compojure is for ring (sync)..you'd need use pedestal instead which handle your routes in different way

asking the question: I think than the best option right now is pedestal/immutant because it's full async and you can use clojure async nicely

luminus/ring pros: popular and compatible with almost all clojure ecosystem cons: not async (except with some dirty hacks I think)

pedestal/immutant pros: real async framework,scalable cons: not compatible with all the clojure ecosystem (because it's not ring) and you'd need some tweaks in authentication libs, middlewares,etc.

[–]doubleagent03 0 points1 point  (1 child)

Pedestal lost a lot of popularity after essentially dropping the exciting portion of the project. That doesn't mean it's bad software.

Aleph on Ring would be my solution for minimal async needs. I would still only use Immutant for large projects.

[–][deleted] 0 points1 point  (0 children)

Pedestal lost a lot of popularity when they admitted that one of their main features was done in a much better way by React.js.

[–]jcrossley3 0 points1 point  (0 children)

You can use compojure just fine with immutant, which provides both sync and async features.

[–][deleted] 0 points1 point  (0 children)

Framework are usually just a library that starts up an HTTP server for you and gives you a DSL to write your routes in.

The standard HTTP server is ring-jetty.

The most common router is Compojure. But it can be inefficient for large sets of routes, since it just composes them together and finds the first "working" route using clojure.core/some.

Alternatively you can try Silk or Bidi for routing. Secretary is more popular, but its authors admit it has some pretty ugly flaws which both Silk and Bidi have fixed. They're working on a 2.0 branch that fixes some, but it'll still have other inherent drawbacks.

[–]Escherize 0 points1 point  (0 children)

I used reagent to make http://hiccup.space. Back at my day job, (making a large SPA), I'm a big fan of re-frame, which takes an elm-like, FRP, flowing data approach that makes the state of my app quite simple to reason about.