datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS

What is datascript?

Immutable database and Datalog query engine for Clojure, ClojureScript and JS

Overview of datascript

What it is

DataScript is an immutable in-memory database and Datalog query engine for Clojure, ClojureScript, and JavaScript. It is designed to run inside the browser, cheap to create, quick to query, and ephemeral. Databases are immutable and based on persistent data structures, similar to a hashmap. It is meant to be a basic building block for client-side applications that need to track a lot of state.

Key features

  • Immutable database as a value; new DBs created on top of old ones without invalidating them.
  • Triple store model with EAVT, AEVT, and AVET indexes.
  • Multi-valued attributes via :db/cardinality :db.cardinality/many.
  • Lazy entities and :db/valueType :db.type/ref auto-expansion.
  • Database mutations via transact! and callback-based listening via listen!.
  • Datalog query engine supporting implicit joins, parameterized queries, recursive rules, aggregates, and pull API.

Use cases

  • Client-side application state management with central, uniform approach.
  • Tracking state evolution, undo/redo, consistent rendering, background sync.
  • Answering non-trivial questions about current app state via Datalog queries.
  • Structured data tracking with Datalog queries against it.

Getting started

;; Leiningen
[datascript "1.8.1"]

;; deps.edn
datascript/datascript {:mvn/version "1.8.1"}

;; npm
npm install datascript

License and pricing

License: Eclipse Public License 1.0 (EPL-1.0). Open source.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/tonskydatascript.svg)](https://yunodb.com/tools/tonskydatascript?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/tonskydatascript?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/tonskydatascript.svg" alt="Featured on YunoDB" height="20"></a>