What project templates do you find useful?

What are templates you consider useful for creating projects (CLI, Leiningen or Boot)?

I am interested in highlighting useful templates for beginners and experience clojure developers alike in the books and videos I create for Practicalli.

I typically use the basic templates, such as app and lib that come with the clj-new project. However for creating simple websites I use figwheel-main (ClojureBridge London and Practical.li websites).

I have found templates useful to learn from without specifically using them to create projects, such as the luminus template.

Do you use https://clj-templates.com/ to find a template, or search for template on clojars or perhaps a general internet search?

Do you create your own templates, e.g. define a common starting point for all projects for your team. Perhaps you take the https://www.juxt.land/edge/ approach of cloning a base project repository.

Thank you.

3 Likes

Great post – I didn’t even know about clj-templates.com!

I don’t have any particular frameworks to list here, but maybe my journey will be of use.

I got started with Clojure coming from other lisps and was going Java-interop for the Java portion of a grad-level AI class. The TAs only knew Java so my code needed to easily run from a Java hook-in. I have no memory of how I figured out how to structure my Clojure pieces.

When I began work work as a web developer I followed “Web Development with Clojure” which totally fast-tracked my understanding and provided me a framework. In the years since then I’ve deviated from any actual lein new luminus setup and just copy-paste my own framework, which has some deviations from Luminus. This is now my major way of templating: I copy-paste others.

I recently jumped into shadow-cljs. This had a similar process: I searched around online and found a template and then based my projects on it. After the experience that started with Luminus I knew enough to adapt the Shadow thing I found to my own needs and have used it several times now to quick-start new projects, when I’m operating in a pure front-end world. So that’s my usual project setup process: find an example setup, adjust its libraries to my requirements, and then in the future just copy my previous project and adjust if necessary. For full-stack stuff this has meant a basically Luminus setup; for cljs stuff this has meant a base shadow-cljs layout like toryanderson.com; and also a stab at a Renatal android/iphone app a few years ago where Renatal provides the structure.

For ClojureScript development, i have mostly used figwheel and found the figwheel-main template to be very useful and easy to use. It creates either a Cloure dep.edn project or a Leiningen project

The figwheel-main has an option for adding reagent, react, rum, om. It uses mount to load the application and is simple enough to understand (perhaps a good starting point for understanding mount and other lifecycle libraries

The reagent template seems to be used often too, although that is specific to Leiningen.


To make this a deps.edn project, you would need to manually add a deps.edn file with the dependencies and add figwheel-main.edn and one or more build configurations. Most of this should be a few lines of code each.

Shadow-cljs it a very good project when extensively using npm libraries with ClojureScript, if I read correctly it uses its own tool t create projects

Any other front-end UI templates used?

I’ve seen https://www.juxt.land/edge/ mentioned last week and it looks super interesting and helpful, so I’ll probably try this for new projects.

However, right now I’m building on top of Fulcro RAD. It’s insanely productive and you can learn a lot from the demo project. It’s well structured, has support for loading different configs such as dev-config vs. production-config and the frontend comes with shadow-cljs which makes integrating other npm libs a piece of cake (Haven’t tried anything other than shadow though, so I can’t really compare).
The backend / API also makes heavy use of Pathom which I like very much.

So, long story short: I’ve searched and tried a lot of templates, but somehow only the Fulcro and Fulcro RAD demos where satisfying to me, so I used them as a starting point.
All in all it’s a lot to take in for new developers, but you’ll learn a lot if you invest the time.

Other than that I’ve got a lot to say about my starting experiences with Clojure, but I’ll save that for another post.

I (as well) copy paste from Luminus (specifically this zip file). My destillation is in a series of short examples: https://github.com/kloimhardt/bb-web

Hi - I think the use of lein templates is an idea who’s time has come and gone. I made one several years ago, but it is so difficult to build & maintain that I stopped.

Instead, I just maintain a Git repo for each of Clojure and ClojureScript that I clone to start a new project:

In general, I think this is far more flexible. Besides each fundamental template in its own Git repo, you could also have variations of the template available on different branches.

I think this is a much more powerful and flexible way of creating template projects, without needlessly complecting template code with a build tool.

Enjoy!

1 Like

This is more-or-less what I do; agreed that lein templates were prohibitively annoying, as much as I appreciate them from luminus. Instead I just stick a rename script in each repo that does the recursive renaming to a new project.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.