datascript
DataScript is an immutable, in-memory Datalog query engine designed for browser and JavaScript environments. It provides a lightweight alternative to traditional databases for managing client-side application state with Clojure/ClojureScript semantics.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | tonsky/datascript |
| Owner | tonsky |
| Primary language | Clojure |
| License | EPL-1.0 — Requires review (not clearly OSI) |
| Stars | 5.8k |
| Forks | 317 |
| Open issues | 80 |
| Latest release | 1.7.8 (2025-10-11) |
| Last updated | 2025-10-11 |
| Source | https://github.com/tonsky/datascript |
What datascript is
An immutable database built on persistent data structures (similar to Clojure's Hashmap) that compiles to JavaScript and supports Datalog queries. It tracks application state changes, provides indexed lookups, and enables time-travel semantics through immutability.
Get the datascript source
Clone the repository and explore it locally.
git clone https://github.com/tonsky/datascript.gitcd datascript# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires ClojureScript or JavaScript compiled version; primary language is Clojure, so Clojure codebases benefit most.
- Shadow-cljs users must configure externs compiler option; documented but adds build complexity.
- Immutable semantics mean familiar SQL patterns (UPDATE, DELETE) require transaction-based state replacement.
- No built-in persistence; integrate with localStorage, IndexedDB, or external storage separately.
- Datalog query syntax differs from SQL; team must learn predicate logic and join semantics.
When to avoid it — and what to weigh
- Server-side or durable persistence is primary requirement — DataScript is ephemeral by design—intended for browser memory. While SQL storage adapters exist, they are separate projects and not the primary use case.
- Team lacks Clojure/Lisp experience — Datalog syntax and Clojure semantics create a learning curve. Teams unfamiliar with functional programming patterns may find adoption slower.
- Need for horizontal scaling or distributed state — Single-process, in-memory architecture; not designed for distributed systems or multi-machine deployment.
- Performance-critical with very large datasets (>100MB+) — While indexed, performance degrades with large volumes. Designed for 'a little data' to moderate datasets in browser contexts.
License & commercial use
Eclipse Public License 1.0 (EPL-1.0). Permissive copyleft license compatible with most open-source projects. Permits use, modification, and distribution; requires preservation of license headers and offers patent protection to contributors.
EPL-1.0 is a recognized OSI-approved permissive license. Commercial use is permitted without seeking additional permission. Derivative works must remain under EPL-1.0. Production adoption by commercial projects (Roam Research, LogSeq, PartsBox, etc.) confirms commercial viability. Recommend legal review of specific use case if bundling/relicensing occurs.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
In-memory database; no network exposure by default. No authentication/authorization layer—applications must implement access control at query/transaction level if needed. Datalog injection possible if queries constructed from untrusted input; treat query construction similarly to SQL (parameterize). No known CVEs noted in data; review security issue tracker if integrating into security-sensitive context. Immutability mitigates certain state-corruption attacks.
Alternatives to consider
Datomic (or Datomic Free)
Full-featured distributed database with Datalog support; heavier weight, requires server. Better if you need durability and distributed features; DataScript lighter if client-only state suffices.
Recoil, Zustand, or Redux (JavaScript state managers)
Simpler, broader ecosystem, no Datalog learning curve. Use if queries are simple (selectors/derived state) and Clojure integration is not a goal.
SQLite WASM
Durable, SQL-based, runs in browser. Use if you need persistence and SQL familiarity; DataScript if you prefer Datalog semantics and immutable architecture.
Build on datascript with DEV.co software developers
DataScript powers production apps like Roam Research and LogSeq. Get expert guidance on integration, architecture, and custom development.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
datascript FAQ
Can I persist DataScript databases to disk?
Is DataScript suitable for real-time collaborative apps?
What JavaScript environments are supported?
How does DataScript handle schema evolution?
Software developers & web developers for hire
DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If datascript is part of your open-source databases roadmap, our team can implement, customize, migrate, and maintain it.
Evaluate DataScript for Your Client-Side State Needs
DataScript powers production apps like Roam Research and LogSeq. Get expert guidance on integration, architecture, and custom development.