Integrant describes itself as a “micro-framework for data-driven architecture”.
It’s a library that lets you split your app into parts, and manage their
interdependencies and start/stop life cycle.
Integrant was created by James Reeves, a prolific Clojure programmer known
online as Weavejester. It occupies the same space as Stuart Sierra’s Component
library, which we’ve covered in detail in episode 26 and 31, but makes some very
different design decisions.
Integrant forms the basis for Duct, a highly modular Clojure Web Framework. If
you’re interested in learning Duct then you should get a good grip on Integrant
To demonstrate Integrant we’ll take a very basic web app, and look at different
ways to approach its implementation. The app implements a HTTP single endpoint,
which responds with the current date and time.
This episode will be self-contained, if you just follow along you should have everything you need. I will link to a github repo with the resulting code in the show notes, in case you want to have a look at the final result.
$ curl localhost:3000
It's Thu Mar 08 16:41:59 CST 2018
I’m using the Clojure CLI tools that came out together with Clojure 1.9. This
deps.edn file contains all dependencies used in this episode.