An excerpt from the repository, fetched Nov 13, 2026.
Read the project’s introduction
Branch databases, not just code.
Datahike is a durable Datalog database with
Datomic-compatible APIs and git-like semantics. Built on persistent data structures and structural sharing,
database snapshots are immutable values that can be held, shared, and queried anywhere—without locks or copying.
Key capabilities:
🌐 Distributed Index Space: Read scaling without database connections—readers access persistent indices directly
🗄️ Flexible storage: File, LMDB, S3, JDBC, Redis, IndexedDB via konserve
🌍 Cross-platform: JVM, Node.js, Browser (Clojure, ClojureScript, JavaScript, Java APIs)
⚡ Real-time sync: WebSocket streaming with Kabel for browser ↔ server
🕰️ Time-travel: Query any historical state, full transaction audit trail
🔒 GDPR-ready: Complete data excision for regulatory compliance
🚀 Production-proven: Tested with billions of datoms, deployed in government services
Distributed by design: Datahike is part of the replikativ ecosystem for decentralized data architectures.
Why Datalog?
Modern applications model increasingly complex relationships—social networks, organizational hierarchies, supply chains, knowledge graphs. Traditional SQL forces you to express graph queries through explicit joins, accumulating complexity as relationships grow. Datalog uses pattern matching over relationships: describe what you're looking for, not how to join tables.
As systems evolve, SQL schemas accumulate join complexity. What starts as simple tables becomes nested subqueries and ad-hoc graph features. Datalog treats relationships as first-class: transitive queries, recursive rules, and multi-database joins are natural to express. The result is maintainable queries that scale with relationship complexity. See Why Datalog? for detailed comparisons.
Time is fundamental to information: Most value derives from how facts evolve over time. Datahike's immutable design treats the database as an append-only log of facts—queryable at any point in history, enabling audit trails, debugging through time-travel, and GDPR-compliant data excision. Immutability also powers Distributed Index Space: database snapshots are values that can be shared, cached, and queried without locks.
You can find API documentation on cljdoc and articles on Datahike on our company's blog page.
We presented Datahike also at meetups,for example at:
2021 Bay Area Clojure meetup
2019 scicloj online meetup.
2019 Vancouver Meetup.
2018 Dutch clojure meetup.
Usage
Add to your dependencies:
We provide a stable API for the JVM that we extend by first providing experimental/beta features that then get merged into the API over time.
(require '[datahike.api :as d])
;; use the filesystem as storage medium
(def cfg {:store {:backend :file
:id #uuid "550e8400-e29b-41d4-a716-446655440000"
:path "/tmp/example"}})
;; create a database at this place, per default configuration we enforce a strict
;; schema and keep all historical data
(d/create-database cfg)
(def conn (d/connect cfg))
;; the first transaction will be the schema we are using
;; you may also add this within database creation by adding :initial-tx
;; to the configuration
(d/transact conn [{:db/ident :name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one }
{:db/ident :age
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one }])
;; lets add some data and wait for the transaction
(d/transact conn [{:name "Alice", :age 20 }
{:name "Bob", :age 30 }
{:name "Charlie", :age 40 }
{:age 15 }])
;; search the data
(d/q '[:find ?e ?n ?a
:where
[?e :name ?n]
[?e :age ?a]]
@conn)
;; => #{[3 "Alice" 20] [4 "Bob" 30] [5 "Charlie" 40]}
;; add new entity data using a hash map
(d/transact conn {:tx-data [{:db/id 3 :age 25}]})
;; if you want to work with queries like in
;; https://grishaev.me/en/datomic-query/,
;; you may use a hashmap
(d/q {:query '{:find [?e ?n ?a ]
:where [[?e :name ?n]
[?e :age ?a]]}
:args [@conn]})
;; => #{[5 "Charlie" 40] [4 "Bob" 30] [3 "Alice" 25]}
;; query the history of the data
(d/q '[:find ?a
:where
[?e :name "Alice"]
[?e :age ?a]]
(d/history @conn))
;; => #{[20] [25]}
;; you might need to release the connection for specific stores
(d/release conn)
;; clean up the database if it is not need any more
(d/delete-database cfg)
The API namespace provides compatibility to a subset of Datomic functionality
and should work as a drop-in replacement on the JVM. The rest of Datahike will
be ported to core.async to coordinate IO in a platform-neutral manner.
Documentation
📖 Complete Documentation Index - Organized by topic and skill level
Quick links:
Configuration - Database setup and backend options
Why Datalog? - Query comparisons and when to use Datalog
Language Bindings - Java, JavaScript, Python, CLI, and more (beta)
Time Variance - Time-travel queries and GDPR-compliant purging
Cross-database references - Value-level dh:// references across databases, living vs record (as-of pinned)
For simple examples have a look at the projects in the examples folder.
Example Projects
Applications
Beleg - Invoice and CRM system with web UI, LaTeX PDF generation, and Datahike persistence. Works as both an example project demonstrating Datahike patterns and a practical solution for contractors and small businesses. Features customers, tasks, offers, and invoices. Successor to the original Datahike invoice demo from Dutch Clojure Meetup 2018.
ClojureScript & JavaScript Support
Datahike has beta ClojureScript support for both Node.js (file backend) and browsers (IndexedDB with TieredStore for memory hierarchies).
JavaScript API (beta):
Install from npm:
npm install datahike@next
Example usage:
const d = require('datahike');
const config = {
store: {
backend: ':memory',
id: d.
Read the full README on GitHub