xNet Documentation
xNet is a local-first workspace and React framework. Your data lives on the device, syncs peer-to-peer, and works offline — and your coding agent can work in it with one command.
Two ways in
Section titled “Two ways in” Connect your coding agent npx @xnetjs/cli connect claude-code — read, query, and edit your workspace from Claude Code or Codex.
Build with React Three hooks replace your entire backend. Build a task manager in 5 minutes.
Get started
Section titled “Get started” Introduction What xNet is and when to use it.
Core Concepts Schemas, hooks, sync — the mental model.
Agent Interfaces The files-first agent surface: checkouts, the xnet CLI, SKILL.md, slim MCP.
The Protocol xNet is an open, re-implementable standard — not just this app.
React Hooks
Section titled “React Hooks” useQuery Read data reactively with filtering, sorting, and pagination.
useMutate Create, update, delete nodes with full type safety.
useNode Collaborative editing with Yjs, P2P sync, and presence.
useIdentity Access the current user's DID and auth status.
Schemas & Data
Section titled “Schemas & Data” defineSchema Define typed schemas with 15 property types.
Property Types text, number, date, select, relation, person, and more.
Relations Link nodes together with relation() and person().
Type Inference How TypeScript types flow from schemas to hooks.
Guides
Section titled “Guides” Authorization Encryption-first access control: schema roles, grants, delegation, and key recovery.
Plugin Development Build extensions with the 4-layer plugin system.
Sync How P2P sync works and how to configure it.
Identity & Keys DID:key pairs, UCAN tokens, and key management.
Real-time Collaboration Collaborative editors with useNode and TipTap.
Offline Patterns Building apps that work without connectivity.
Infinite Canvas Spatial canvas with R-tree indexing and layout algorithms.
Rich Text Editor TipTap editor with Yjs collaboration and slash commands.
Hub & Signaling Signaling server, self-hosting, and Hub roadmap.
Connect to xNet Cloud Link your web, desktop, or mobile app to a managed hub.
DevTools 9 debug panels, event bus, and instrumentation.
Electron Setup Running xNet in an Electron desktop app.
Testing Testing xNet apps with Vitest.
Concepts
Section titled “Concepts” Local-First Why local-first matters and how xNet implements it.
CRDTs Conflict-free replicated data types explained.
Network & Transport libp2p, WebRTC, security layers, and peer scoring.
Sync Architecture Dual-CRDT model, Lamport clocks, and merge strategies.
Packages
Section titled “Packages”| Package | Description |
|---|---|
@xnetjs/react | React hooks: useQuery, useMutate, useNode, useIdentity |
@xnetjs/data | Schema system, NodeStore, 15 property types |
@xnetjs/sync | Lamport clocks, Change<T>, Yjs security |
@xnetjs/crypto | BLAKE3, Ed25519, XChaCha20-Poly1305 |
@xnetjs/identity | DID:key, UCAN tokens, key management |
@xnetjs/plugins | 4-layer plugin system (scripts, extensions, services, integrations) |
@xnetjs/storage | SQLite adapter |
@xnetjs/editor | TipTap rich text editor with Yjs collaboration |
@xnetjs/canvas | Infinite canvas with spatial indexing |
@xnetjs/network | libp2p, WebRTC/WebSocket transport |