Roam Research: Architecture, Datalog & Benchmarks
A systems teardown of Roam Research: how in-memory DataScript Datalog databases, atomic block-level UID trees, and bidirectional link indexing pioneered networked thought.
Entire graph held in-memory as an immutable Datalog database in the browser.
Every bullet point is an atomic entity with a globally unique identifier (UID).
Centralized cloud persistence with proprietary real-time event streaming.
Roam Research Deep-Dive Chapters
The Breakthrough and Constraint of In-Memory Datalog
Before Roam Research launched in 2019, note-taking applications treated documents as flat hierarchical text files stored in folders. Roam treated knowledge as an interconnected graph database. Instead of files, every single bullet point is an entity with a 9-character UID. By embedding DataScript (an in-memory Datalog database written in ClojureScript) directly inside the user's web browser, Roam made bidirectional linking, block references, and nested queries instantaneous.
However, holding the entire knowledge graph in browser memory has physical limitations. As a user's graph expands beyond 50,000 blocks with heavy image attachments and complex transclusions, client memory consumption climbs past 1.5 GB. Initial graph download times can exceed 10 seconds over high-latency connections, highlighting the inherent tension between in-browser graph computation and scale.