Collaborative notes
This guide walks through a practical collaborative notes pattern using NodalMerge. You will implement:- Shared note content with text CRDT semantics
- Metadata and list/index state with map/list primitives
- Presence-driven collaboration signals (cursors, active users)
- Local-first writes with eventual canonical refinement
Data model
Use separate namespaces by concern:notes/<noteId>/contentfor text bodynotes/<noteId>/meta/*for title/tags/author metadatanotes/index(list or map) for ordering and note referencespresencepayloads for ephemeral cursor/selection state
Step 1: connect the room
Step 2: model note content and metadata
Step 3: wire UI updates
Subscribe to runtime or note-specific signals and re-read current note projection for rendering. Pattern:- Event arrives
- Read current text + metadata keys
- Re-render note UI
Step 4: add presence
Step 5: support offline editing
Enable local persistence and treat edits as optimistic:- Apply edits immediately
- Push when connected
- Reconcile canonical updates after reconnect
Suggested UX states
Use explicit editor states:connectedreconnectingoffline-localsyncingconflict-or-rejection-visible
Common pitfalls
- Storing note content in presence
- Using map writes for rich editable text
- Ignoring reconnect state transitions in editor UI
- Not separating note metadata and body keys
Verification checklist
- Two clients edit same note concurrently and converge
- Offline edit then reconnect merges as expected
- Presence appears/disappears correctly per peer lifecycle
- Metadata updates do not corrupt text content rendering