Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Clojars Project Coverage Status cljdoc badge Build Status

A Clojure library wrapping unleash java client


Getting feature toggles

(require '[unleash-client-clojure.unleash :as u]
         '[unleash-client-clojure.builder :as b])
;; a simple client
(def unleash (u/build (b/app-name "app-name") (b/unleash-api "")))
;; simple toggle
(u/enabled? unleash "Bit")
;; toggle with context
(require '[unleash-client-clojure.context :as c])
(def user-context (c/build (c/user-id "user-id")))
(u/enabled? unleash "toggle-name" user-context false)
;; more configuration can be passed by using the functions in the builder namespace
(require '[unleash-client-clojure.builder :as b])
(def unleash (u/build "app-name" "instance-id" "" (b/environment "staging") (b/fetch-toggles-interval 15)))

Variant support

(require '[unleash-client-clojure.variant :as v])
(u/get-variant unleash "DemoVariantWithPayload")
(let [x (u/get-variant unleash "DemoVariantWithPayload")]
  [(v/get-name x)
   (v/get-type x)
   (v/variant-enabled? x)
   (v/get-value x)])

Advanced client config

;; the builder namespace supports passing builder confgurations as functions
(require '[unleash-client-clojure.builder :as b])
(def unleash (u/build
               (b/app-name "app-name")
               (b/unleash-api "")
               (b/environment "staging")
               (b/fetch-toggles-interval 1)))
;; see the builder namespace for more available options

Subscriber support

;; one a subscriber can be pased to the client builder by passing
(b/subscriber my-subscriber)
;; the subscriber namespace has functions to help you build a subsriber
(require '[unleash-client-clojure.subscriber :as s])
;; pass a map with the keys [:on-error :on-event :toggle-evaluated
;; :toggles-fetched :client-metrics :client-registered :toggles-backed-up
;; :toggle-backup-restored] and callbacks you want to register.
;; any missing key defaults to no-op
;; this is a very noisy example:
(def unleash
    (b/app-name "app-name")
    (b/unleash-api "")
      (s/build {:on-event println})))


  • Integration testing