Local Setup
This page is for users who have chosen Datomic Local and covers getting Datomic Local and starting a Datomic Local system.
- How to get and configure Datomic Local
- How to create a client
Get Datomic Local
Datomic Local is available on Maven. You can include it in project deps with:
com.datomic/local {:mvn/version "1.0.301"}
Configure Local Storage
By default, Datomic stores all databases under a common storage
directory. To specify this directory, create a .datomic/local.edn file in
your home directory, containing a map with :storage-dir and an
absolute path:
{:storage-dir "/full/path/to/where/you/want/data"}
Create a Client
There are two ways to get a local client:
- You can explicitly request a local client
- You can divert requests for Datomic Cloud clients to use local storage for development and testing
To explicitly request a local client, pass a map to d/client with:
:server-type :datomic-local- A
:systemname,
(require '[datomic.client.api :as d]) (def client (d/client {:server-type :datomic-local :system "dev"}))
If you are using Datomic Local to develop and test a Datomic Cloud application, add the client-cloud dependency to your project. Then, to divert an existing Datomic Cloud system to Datomic Local, call divert-system:
(require '[datomic.local :as dl]) (dl/divert-system {:system "production"}) ;; existing requests for Cloud system will be served locally! (def client (d/client {:system "production" :server-type :ion :region "us-east-1" :endpoint "https://ljfrt3pr18.execute-api.us-east-1.amazonaws.com"}))
You can also use import-cloud to import data from Datomic Cloud to local storage.
Next Steps
If you are trying Datomic Local for the first time, try the Client Tutorial.
See also:
- Datomic Local API
- Datomic Local Operations docs, including limitations, sample data, and storage options
- Datomic Local change log