datahike

whilo 2025-09-12T15:04:51.572559Z

If somebody is interested, Datahike cljs works in memory now (WIP), you can find it in this branch https://github.com/replikativ/datahike/tree/cljs-lean-cps. If we had a konserve store that holds all values in memory to read (including loading all of them at init), but writes through into an underlying durable store, then this would already work as a durable database, since our transact/writing pipeline is already fully async. One could do this with a memory->indexeddb->remote backend store (e.g. S3/sql) hierarchy for instance.

🙌 1
🤩 3
whilo 2025-09-12T15:33:12.014439Z

You might have to point the deps entries for the persistent sorted set back to git.

whilo 2025-09-12T15:05:32.367419Z

Here is the sandbox I played around with:

(ns sandbox
  (:require
   [datahike.api :as d]
   [clojure.core.async :refer [<! >! chan put! close!]])
  (:require-macros [clojure.core.async :refer [go]]))

(def schema [{:db/ident       :name
                :db/cardinality :db.cardinality/one
                :db/index       true
                :db/unique      :db.unique/identity
                :db/valueType   :db.type/string}
               {:db/ident       :sibling
                :db/cardinality :db.cardinality/many
                :db/valueType   :db.type/ref}
               {:db/ident       :age
                :db/cardinality :db.cardinality/one
                :db/valueType   :db.type/long}])

(def cfg {:store {:backend :mem :id "sandbox"}
          :keep-history? true
          :schema-flexibility :write
          :attribute-refs? false})

(go
  (def cfg (<! (d/create-database cfg))))

(def conn (d/connect cfg))

(go
  (def tx-report (<! (d/transact! conn schema))))

(go 
  (def tx-report2 (<! (d/transact! conn [{:name "Petersjj"
                                          :age 42}]))))

;; c.historical is not a function
(d/q '[:find ?e ?v :where [?e :name ?v]] @conn)

(into {} (d/entity @conn 4))


(d/pull @conn '[:db/id :name] 4)

(d/as-of @conn (js/Date.))


(d/history @conn)

(d/datoms @conn :eavt)

timo 2025-09-12T15:06:04.443839Z

you're thinking about browser-use-cases here?

whilo 2025-09-12T15:06:18.776449Z

Most definitely.

alekcz 2025-09-12T15:07:19.183899Z

If it works in JS you could deploy at the edge with clouldflare and then have a central server for linear writes

whilo 2025-09-12T15:07:21.709799Z

@pat and I are working on making the index data structure and query engine async with https://github.com/simm-is/partial-cps

❤️ 3