Skip to content

API reference

datadata is imported by subpath: each @repo/datadata/<name> holds one part of the API. An application defines its documents with schema and connects withclient; a backend runs server on a storage adapter.

@repo/datadata/authz

Declarative authorization: evaluating a schema's access rules for a principal, the role vocabulary, and the scope checks behind every read and write decision.

@repo/datadata/client

Creating a datadata client, the connection to a server that reads, subscribes to and optimistically writes documents.

@repo/datadata/commands

Domain commands: the app's named, typed mutators (defineCommands) that the client runs for its optimistic view and the server runs authoritatively, each granted as an authorization kind of its own.

@repo/datadata/document

The document model every other subpath builds on: the document handle, write results, and the errors reads and writes reject with.

@repo/datadata/events

The wire protocol between client and server: the event types, their parsers, and the transport constants.

@repo/datadata/in-memory

The whole engine in one process: an in-memory client and storage for demos, tests and prototypes that need no server.

@repo/datadata/in-process

Connecting a real client to a server in the same process without a socket, for example inside a Durable Object.

@repo/datadata/logger

The logger interface datadata reports through, and a console logger for the browser.

@repo/datadata/persistence

Offline persistence for the client: the adapter interface for caching documents and pending writes, and an in-memory implementation.

@repo/datadata/persistence-idb

The IndexedDB persistence adapter, for offline support in the browser.

@repo/datadata/projection

Projections: declarative read models over a document's records (filter, sort, group, resolve), and which projected fields can be written back.

@repo/datadata/schema

Defining document schemas: field types, access rules, and the registry that clients and servers validate documents against.

@repo/datadata/server

Running a datadata server: the engine that validates, authorizes, stores and broadcasts document changes, and the storage adapter interface it runs on.

@repo/datadata/session

Sessions over documents: the live session, and staging sessions that collect changes as a changeset before they reach the documents.

@repo/datadata/system

The system documents an application reads directly: access and identity, sync status, the document index and trash, schema documents and presence channels.

@repo/datadata/test

Test helpers: a mock live client, a recording logger, and a collector for write errors.

@repo/datadata/utils

Utilities shared across datadata and its consumers: JSON Patch application, prototype-safe own-key access, and fractional indexing for ordered lists.

@repo/datadata/yjs

Yjs integration: awareness (cursors and selections) bridged into datadata presence.