«

Datomic Local

With Datomic Local you can develop and test applications with minimal connectivity and setup. Get the Datomic Local library, add it to your classpath, and you have full access to the client API. This allows you to:

Datomic Local is available at no cost and is Apache licensed.

Durability

Datomic Local stores data to your local filesystem, in directories under the :system you specify when creating a Datomic Local client.

Each database will store transactions in a directory named <storage-dir>/<system-name>/<database-name>. You can "backup" or "restore" a Datomic Local database simply by copying the database directory.

Memdb

Sometimes durable storage is unnecessary and/or inconvenient. For example, a CI system may not need data after the tests run and no access to a file system.

You can force Datomic Local to use a memory-only database by passing :storage-dir :mem to the map you pass when creating a client, as shown in the example below:

(def client (d/client {:server-type :datomic-local
                       :storage-dir :mem
                       :system "ci"}))

Limits

  • Datomic Local is in-process with your application code, and has all the tradeoffs (vs. a server or cluster) that this implies.
  • Datomic Local requires 32 bytes of JVM heap per datom. You should plan your application with this in mind, while also leaving memory for your application's use.
  • Datomic Local relies on OS page caching for performance, so leave some RAM available (i.e. not allocated to the JVM heap) for this.
  • Datomic Local limits the total number of datoms in a transaction to 105.
  • Datomic Local limits strings to 4096 characters.
  • Datomic Local uses shared FileChannels. This is very efficient but is intolerant of Thread.interrupt. If you interrupt Datomic Local I/O, subsequent I/O may trigger a ClosedChannelException. Try to avoid using interrupt as a control mechanism. If you cannot, you can resume by calling release-db and reacquiring a connection.

Datomic Local is best suited for small, single-process applications. For larger projects, create a Datomic Cloud or Datomic Pro system.

Sample Data

datomic-samples is a set of databases that are used throughout these Datomic docs and the Day of Datomic tutorials. To install the Datomic samples on your local computer:

You can connect and use them by setting your Datomic Local system name to "datomic-samples":

(require '[datomic.client.api :as d])
(def client (d/client {:server-type :datomic-local
                       :system "datomic-samples"}))
(d/list-databases client {})
=> ["mbrainz-subset" "solar-system" "social-news" "movies" ...]

Upgrading Base Schema

Every Datomic database starts with a base schema, whose identifiers are namespaced with :db. When the Datomic team enhances the base schema, all databases created with new versions of Datomic get the enhancements automatically.

Existing databases do not automatically incorporate enhancements to the base schema. Your application must first use the minimum version of Datomic required for the base schema features you want:

Base schema features and the minimum Datomic Local version supporting each
Feature Minimum Datomic version Released
:db.tuple/discontinued 1.0.300 2026-07-14

Then pass the :upgrade-schema action to administer-system. For example:

(d/administer-system client {:server-type :datomic-local
                             :action :upgrade-schema})

Upgrading a schema is an idempotent operation, so it will not harm your data to call it more than once. That said, you should treat administer-system as a potentially expensive operation. Call it only when you need it, not before every call to connect.

Once you have used a base schema feature in a particular database, do not run any Datomic Local process on versions of Datomic older than the features used. Check the table above.