xNet Documentation
xNet is a local-first React framework. Your data lives on the device, syncs peer-to-peer, and works offline. Three hooks replace your entire backend.
Get started
Section titled “Get started” Introduction What xNet is and when to use it.
Quick Start Build a task manager in 5 minutes.
Core Concepts Schemas, hooks, sync — the mental model.
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 16 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” 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.
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 |
|---|---|
@xnet/react | React hooks: useQuery, useMutate, useNode, useIdentity |
@xnet/data | Schema system, NodeStore, 16 property types |
@xnet/sync | Lamport clocks, Change<T>, Yjs security |
@xnet/crypto | BLAKE3, Ed25519, XChaCha20-Poly1305 |
@xnet/identity | DID:key, UCAN tokens, key management |
@xnet/plugins | 4-layer plugin system (scripts, extensions, services, integrations) |
@xnet/storage | IndexedDB adapter |
@xnet/editor | TipTap rich text editor with Yjs collaboration |
@xnet/canvas | Infinite canvas with spatial indexing |
@xnet/network | libp2p, WebRTC/WebSocket transport |