Skip to content


Switch branches/tags

Latest commit


Git stats


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


A library resembling mount, but different on some key things:

  • Clojure only, dereferencing states only.
  • Minimal API, based on usage in several larger projects. Less turned out to be more.
  • Supports multiple system instances simultaneously, enabling parallel testing for instance.
  • Easily extensible, without touching the core. Several extensions are provided, such as tools.namespace integration and inferred dependency graphs.

Getting started

Add [functionalbytes/mount-lite "2.2.1"] or functionalbytes/mount-lite {:mvn/version "2.2.1"} to your dependencies and make sure Clojars is one of your repositories.

You can find all the documentation about mount-lite, what makes it unique, and the API by clicking on the link below:


A primer

Require the mount.lite namespace, and other namespaces you depend on.

  (:require [mount.lite :refer (defstate) :as mount]
            [ :as config] ;; <-- Also has a defstate.
            [some.db.lib :as db]))

Define a defstate var, including the :start and :stop lifecycle expressions.

(defstate db
  :start (db/start (get-in @config/config [:db :url]))
  :stop  (db/stop @db))
;=> #'

Then start all defstates, use (start). A sequence of started state vars is returned. The order in which the states are started is determined by their load order by the Clojure compiler. Calling (stop) stops all the states in reverse order.

;=> (#' #'

;=> object[some.db.Object 0x12345678]

;=> (#' #'

;=> ExceptionInfo: state db is not started

That's it, enjoy!

Core development features

Next to above basic usage, the core provides three more concepts:

  • Substitutes: replace default defstate implementations with substitutes, for testing or REPL sessions.

  • Start/stop "up-to": only start (or stop) the defstates sequence to a certain defstate.

  • Multiple systems: start multiple instances of defstate systems concurrently.


The core provides an easy extension point. The following extensions are currently provided:

  • Basic: start only certain states, or all states except certain states.

  • Data-driven: start the states according to an EDN specification.

  • Refresh: use mount-lite in combination with the "refresh" functionality of the tools.namespace library.

  • Inferred dependencies: only start (or stop) states based on an inferred dependency graph using the tools.namespace library.

  • Explicit dependencies: only start (or stop) states based on an explicitly declared dependency graph.

  • Autostart: automatically start states (and its dependencies) on first use.

Version 2.x

Version 2.x is breaking with the 0.9.x versions. Version 2.0 introduced the ability to run multiple systems of states simultaneously. This was an opportunity to get rid of the excess, based on experience in several larger projects. It has become really "lite", especially the core, while providing an easy to understand extension point for more advanced features. This blog post explains what has changed in version 2.0 in detail, and why.

Version 0.9.x will still be maintained, and can be found under the 1.x branch.


Copyright © 2017-2020 Functional Bytes

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

2.x branch: Circle CI