Quickstart
This guide walks you through a full local setup with thenodalmerge-server binary and the JavaScript SDK.
1. What you’re building
NodalMerge is a local-first, replicated state engine built around:- Deterministic CRDT state resolution
- DAG-based transaction history
- Speculative vs authoritative execution paths
- Room-based sync topology
- Accept writes while offline
- Merge concurrent edits deterministically
- Converge to the same state across peers
2. Core concepts (minimal)
Document
A document is a logical container of replicated state.Room
A room is a sync boundary. All replication happens within a room.Transaction
A transaction contains operations (text, map, list, etc.) and is the atomic unit of replication.Sync
Peers exchange transactions. The engine resolves state deterministically.3. Start a local server
From thenodalmerge repo root:
ws://127.0.0.1:7878/ws/<room>.
Optional checks:
- Visit
http://127.0.0.1:9090/metricsfor Prometheus metrics - Confirm the server logs a startup message for the WebSocket endpoint
4. Connect a client
Install the SDK in your app:5. Write replicated data
Map example
Read example
Text example
6. Add live presence
7. Handle offline and reconnect
The SDK supports reconnect and optional local persistence.- Keep
reconnect.enabledon for production clients - Use
offline.persistenceKeyor IndexedDB persistence when you need durable local-first behavior - Call
sdk.sync.push()after local changes to flush outbound ops
8. Speculative vs authoritative flows
In many products, you split writes into two lanes:- Speculative lane for immediate UI response
- Authoritative lane for validated canonical state
intent/**for optimistic client intentworld/**for canonical state accepted by policy
9. Next steps
After this quickstart:- Read
architecture/mental-modelandarchitecture/crdt-model - Read
protocol/synchronizationandprotocol/blob-flow - Implement from
sdk/javascriptorsdk/react - Configure production baseline from
operators/server-setupandoperators/persistence - Embedding NodalMerge inside your own web app instead of running the standalone
server? See
operators/server-setup#embedding-the-host-as-a-library— the embeddable hosts hand you the request pipeline directly, so you configure CORS yourself rather than inheriting it from the package - Lock down auth posture in
operators/security-and-auth - Add incident checks from
operators/troubleshooting - Review command contracts in
api-reference/websocket-commands - Review performance expectations in
benchmarks/performance-overview