Peer Language Support

JVM Languages

The Datomic team supports the Java and Clojure APIs. Community supported, third-party libraries are described in the section Third-party Libraries.


The Java API gives Java users access to all the features of the Peer library. Additionally, the Util class contains convenience functions for creating and working with Datomic's commonly used datastructures.


The Clojure API is a functional projection of the Java API. The methods of the Java types are flattened to functions in a single datomic.api namespace with an instance of the given type as the first argument.

It is idiomatic to reference the datomic.api namespace as d, with db and q added to the current namespace.

(ns project-ns
  (:require [datomic.api :as d :refer [db q]]))

The code below illustrates the translation of the Java API to Clojure.

Here is the code in Java:

String uri = "datomic:mem://test";
Connection conn = Peer.connect(uri);
Collection results = Peer.query("[:find ?e :where [?e :db/doc]]", conn.db);

and the equivalent code in Clojure:

;; clojure
(def uri "datomic:mem://test")
(def conn (d/connect uri))
(def results (q '[:find ?e :where [?e :db/doc]] (db conn)))

Other JVM Languages (JRuby, Scala, Groovy etc.)

Users of other JVM languages can use the Java API via their respective Java interop capabilities.

Non-JVM Languages

Non-JVM languages can access Datomic through the REST service via HTTP.

The REST Service

A Datomic peer can be run as a standalone HTTP service. See the REST service documentation for information on starting and stopping the service. Many clients can connect to a single instance of the HTTP service, and one instance of the service represents one licensed peer.

The service is its own documentation. Just point a browser at the root of the server:port on which you started the service. Note that the 'web app' that results is the service. It is not an app built on the service, nor a set of documentation pages about the service. The URIs, query params, and POST data are the same ones you will use when accessing the service programmatically.

In addition to the self-describing nature of the REST service, some basic documentation of the available endpoints is available in the REST service documentation.

The REST service accepts and responds with EDN data.


EDN is an extensible data notation (pronounced [eed-n]). For more information, see the specification. Reader/writer implementations are available in various languages.

A full-featured client of the Datomic REST service should support round-trip conversions between native data structures and EDN, the data format that the REST service sends and receives. Doing so would allow users of the native language to build transactions and queries using native data structures, just like users of the Peer library in JVM languages.

Third-party Libraries

Datomic community members have contributed the following language-specific libraries which provide idiomatic support for Datomic. The Datomic team encourages third-party language libraries, but does not support them directly.