At a first casual glance, “Organizing Clojure code” might sound like a trivial problem to some. It’s easy to get it wrong because it’s subtle. The real question is not just about how to organize code, which is a static artifact, but rather how to organize the runtime manifestation of that code in production, tests, development, and REPL, etc. This blog post is inspired by the discussion at and here we try to explore the various aspects of organizing Clojure code. You only need elementary knowledge of Functional Programming and Clojure application development at the minimum to follow along.

Do we need Dependency Injection with Clojure? That’s a slightly misplaced question — it does not even begin with the problem definition. Clojure is a functional programming language. In this post we would explore the “dependency problem” with Clojure programming and what dependency injection can bring to the table. Later, we discuss DIME, a Push-model based dependency injection library.

Functions are “Contract + Implementation”

Consider the following function:

(fn save-order [db-connection order-details]) ; caller passes two args

This function requires the caller to pass two arguments, which forms its API contract. It all sounds well until the caller is in conflict with this contract. What…

Update (2019, Feb 11): Code snippet updated to configure client mode.

More and more websites and web services are adopting HTTPS today, which makes SSL termination on dedicated IP addresses increasingly challenging. Server Name Indication is a common way to multiplex multiple SSL termination on a single IP address. SNI is implemented as a Transport Layer Security (TLS) extension, hence connecting with an SNI-enabled HTTPS endpoint requires an SNI-aware client.

HTTP Kit is a popular web server and client for the Clojure programming language. SNI support was recently added to the HTTP Kit client. However, we need to configure the…

Shantanu Kumar

Experienced software artisan. Into Open Source, functional programming, Java, Clojure, databases, distributed systems, scalability, performance.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store