{"id":32184510,"url":"https://github.com/6pages/datomic-utils","last_synced_at":"2026-02-20T16:01:50.429Z","repository":{"id":57716437,"uuid":"370210976","full_name":"6pages/datomic-utils","owner":"6pages","description":"utilities for working with Datomic","archived":false,"fork":false,"pushed_at":"2021-06-11T22:24:10.000Z","size":53,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-21T23:50:56.069Z","etag":null,"topics":["clojure","datomic"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/6pages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-24T02:59:53.000Z","updated_at":"2023-07-17T06:11:19.000Z","dependencies_parsed_at":"2022-09-26T16:40:18.254Z","dependency_job_id":null,"html_url":"https://github.com/6pages/datomic-utils","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/6pages/datomic-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6pages%2Fdatomic-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6pages%2Fdatomic-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6pages%2Fdatomic-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6pages%2Fdatomic-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/6pages","download_url":"https://codeload.github.com/6pages/datomic-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6pages%2Fdatomic-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29656589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","datomic"],"created_at":"2025-10-21T23:50:48.915Z","updated_at":"2026-02-20T16:01:50.419Z","avatar_url":"https://github.com/6pages.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datomic-utils\n\nUtilities for working with Datomic.\n\n[![Clojars Project](https://img.shields.io/clojars/v/com.6pages/datomic-utils.svg)](https://clojars.org/com.6pages/datomic-utils)\n\n[![](https://cljdoc.org/badge/com.6pages/datomic-utils)](https://cljdoc.org/jump/release/com.6pages/datomic-utils)\n\n\n## Status\n\nRunning in production at [6Pages](https://www.6pages.com) but unstable\nand subject to change. Let's call it an _early_ release.\n\n\n## Features\n\nThe most interesting features in the library are:\n\n1. schema migrations\n2. query abstraction\n\n\n### schema migrations\n\nDatomic recommends that we [grow our schema and never break\nit](https://docs.datomic.com/cloud/best.html#grow-schema). However,\nthey leave it up to us (the user) to decide how to manage the\nmigrations of schema accumulation.\n\nThis library includes a simple solution. \n\n+ Your application code keeps a collection of schemas\n+ `com.6pages.datomic.schema` stores an applied schema version number in Datomic\n+ whenever you add new schemas (new schema version), `com.6pages.datomic.schema/update!` will make sure that all schema collections have been transacted up to the most recent version\n\nHere's what a collection of schemas might look like:\n\n```clojure\n[\n ;; version 0\n [\n  ;; schema\n  {:db/ident       :com.6pages.datomic.schema/version\n   :db/valueType   :db.type/long\n   :db/cardinality :db.cardinality/one}]\n\n ;; version 1\n [\n  ;; Person\n  {:db/ident       :person/id\n   :db/valueType   :db.type/uuid\n   :db/unique      :db.unique/identity\n   :db/cardinality :db.cardinality/one}\n  {:db/ident       :person/name\n   :db/valueType   :db.type/string\n   :db/cardinality :db.cardinality/one}]\n\n ;; version 2\n [\n  ;; \n  {:db/ident       :person/friend\n   :db/valueType   :db.type/ref\n   :db/cardinality :db.cardinality/many}]\n ]\n```\n\nYou must explicitly define the attribute storing the schema version in\nyour first version (there's a validation exception if you forget).\n\nAs you need to add more schema definitions, you simply add another\nversion collection and run `com.6pages.datomic.schema/update!` on all\nyour databases.\n\n\n### query abstraction\n\nDo you find yourself writing many queries for one (or more)\nattribute \u0026 value pairs?\n\n```clojure\n(d/q\n  db\n  '[:find (pull ?e [*])\n    :in $ ?id\n    :where\n    [?e ::id ?id]]\n  person-id)\n```\n\nThis library has some simple abstractions to build these types of\nqueries.\n\n```clojure\n(ns person\n  (:require [com.6pages.datomic :as d]))\n  \n(def opts\n  {:client (d/client {}) :db-name \"dev\"})\n  \n(d/p-\u003e opts ['*] [[::id id]]) ;; single result\n\n(d/p-\u003e\u003e opts ['*] [[::name \"Bob\"]]) ;; collection of results\n```\n\n\n## Usage\n\n### In a Clojure project\n\n1. [add to dependencies](https://clojars.org/com.6pages/datomic-utils)\n\n2. require in a namespace\n\n```clojure\n(ns person\n  (:require \n    [com.6pages.datomic :as d]\n    [com.6pages.datomic.schema :as ds]))\n```\n\n3. build Datomic client options\n\n```clojure\n(def opts\n  {:db-name \"dev\"\n   :client \n    (d/client \n    ;; use your own Datomic client config\n    {:server-type :dev-local\n     :system \"datomic-samples\"})})\n```\n\n4. apply your schema\n\n```clojure\n(def schemas [\n  [{:db/ident       :com.6pages.datomic.schema/version\n    :db/valueType   :db.type/long\n    :db/cardinality :db.cardinality/one}]\n  [{:db/ident       :person/id\n    :db/valueType   :db.type/uuid\n    :db/unique      :db.unique/identity\n    :db/cardinality :db.cardinality/one}\n   {:db/ident       :person/name\n    :db/valueType   :db.type/string\n    :db/cardinality :db.cardinality/one}]])\n     \n(ds/update! opts schemas)\n```\n\n5. transact!\n\n```clojure\n(def entity\n  (d/transact!\n    opts\n    [{:person/id (java.util.UUID/randomUUID)\n      :person/name \"Ada\"}]))\n```\n\n### REPL and tests\n\n1. [setup dev-local](https://docs.datomic.com/cloud/dev-local.html)\n2. `clj -A:local -A:dev` (you may also want to add a REPL server, if you're into that sort of thing)\n\n\n## Related work\n\n+ [avodonosov/datomic-helpers](https://github.com/avodonosov/datomic-helpers)\n+ [halgari/fafnir](https://github.com/halgari/fafnir)\n+ [flyingmachine/datomic-junk](https://github.com/flyingmachine/datomic-junk)\n\n\n## License\n\nCopyright © 2021 6Pages Inc.\n\nDistributed under the [Eclipse Public License](https://www.eclipse.org/legal/epl-v10.html), the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F6pages%2Fdatomic-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F6pages%2Fdatomic-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F6pages%2Fdatomic-utils/lists"}