Skip to content

Plexus

Plexus lets TypeScript models participate in a replicated Yjs document while MobX keeps local views reactive. It is for applications that already have a data model and need collaboration without converting every feature into raw CRDT operations. It does not replace Yjs or MobX.

The example below follows the current Plexus repository README. Decorate the fields that belong in the shared document; leave derived values as MobX computations.

import { autorun, computed } from 'mobx';
import { Plexus, PlexusModel, syncing } from '@here.build/plexus';
@syncing('Task')
class Task extends PlexusModel<Project> {
@syncing accessor title = '';
@syncing accessor done = false;
}
@syncing('Project')
class Project extends PlexusModel {
@syncing accessor name = '';
@syncing.child.list accessor tasks: Task[];
@computed get openCount() {
return this.tasks.filter((task) => !task.done).length;
}
}
const plexus = Plexus.bootstrap(new Project({ name: 'ship' }));
const root = plexus.root;
autorun(() => console.log(`${root.name}: ${root.openCount} open`));
const task = new Task({ title: 'write the demo' });
root.tasks.push(task); // the Task now belongs to the shared document
task.done = true; // local derivations update; peer edits do too

The point of the ownership step is important: constructing a Task alone does not put it in the document. Adding it to root.tasks does. The source README also demonstrates synced lists, sets, records, and maps.

To build and test the current checkout:

Terminal window
git clone git@github.com:here-build/plexus.git
cd plexus
pnpm install
pnpm build
pnpm test

The core models live in packages/plexus. The family also includes a Durable Object sync server (plexus-do), virtual filesystem models (plexus-vfs), and MessagePort transport packages. They solve different integration problems; you do not need all of them to understand the core model. The existing Plexus docs site remains the detailed guide while this shared site grows.

This explanation is synthesized from plexus/README.md and plexus/packages/plexus/README.md in the current Plexus checkout. For model identity, ownership, undo, and awareness, follow the package README and existing plexus/docs/ guides. Those source files—not this introduction—define the current API.