A JSON patch describes a change to an object with an operation, path, and value. Sahu shows adding properties to an empty object, then applying a patch through a Redux reducer using Immer’s `applyPatches`. Patches can update application state without writing a separate reducer for each change.
Building Real-Time Multi-User Apps With JSON Patches
Speaker
Sanketh Sahu, software engineer and CEO at GeekyAnts, explains how JSON patches can support real-time multi-user apps in a React Native EU presentation, drawing on the design tool BuilderX.
Storing patches preserves the sequence of changes, which can support version history and reconstructing earlier states. It can take more storage and computation to rebuild a state, and a snapshot alone cannot reveal the patches that produced it. Because patches are serializable, they can also sync document changes between threads or over a network.
Sahu introduces Sync State, an experimental React state library built on Redux and Immer. Its `useDoc` hook and `setDoc` callback let components read and update a shared document while Immer generates patches behind the scenes. Sync State uses path-based listeners so updates reach components using the changed data, instead of running selectors for every connected component.
The history plugin stores patches for undo and redo rather than full state snapshots. For multiplayer, the remote plugin buffers local patches until the server accepts them, reverses rejected changes, and handles ordering. Sahu’s examples show unrelated edits, such as changing color and size, both succeeding; when clients change the same property, the server’s last accepted value becomes the source of truth. Undo and redo stacks remain local to each client.
Sahu describes Sync State as an early, evolving release and invites community feedback. The team was exploring REST and GraphQL plugins to sync local document mutations with backend data, along with plugins for forms, API calls, and persistent storage. He credits Himanshu, Rohit, Suraj, and Ankur for work on the release and documentation.
Takeaways
- Use patches when you need a portable record of document changes that can be replayed across clients or threads.
- Patch history can provide undo, redo, and versioning without storing a full snapshot for every change.
- For responsive interfaces, subscribe components to the document paths they use so unrelated updates do not trigger them.
- Define server rules for patch ordering, rejection, and conflicting edits before building collaborative features.
- Keep undo and redo history client-local when one user’s undo should not reverse another user’s work.
Mentioned in this talk
Search inside this talk
What was claimed 12
- featureBuilderX: Real-time multiplayer access to shared design documents
“Recently, we added a sort of real-time multiplayer feature”
YouTube Unverified1 source· Talk
- role atSanketh Sahu is software engineer at GeekyAnts
“I'm Sanketh, a software engineer and CEO at GeekyAnts.”
YouTube Unverified1 source· Talk
- ceo ofSanketh Sahu CEO of GeekyAntsCEO
“I'm Sanketh, a software engineer and CEO at GeekyAnts.”
YouTube Unverified1 source· Talk
- featureSync State: History and remote syncing for React documents
“works on the document and makes it easy for anyone trying to build real-time, multi-user apps.”
YouTube Unverified1 source· Talk
- builtSync State built BuilderX
“we’ve tried to pull them into a separate npm library called Sync State.”
YouTube Unverified1 source· Talk
- usesSync State uses JSON Patch
“It’s all based on JSON patches for actions.”
YouTube Unverified1 source· Talk
- usesSync State uses Immer
“It uses Redux internally and Immer to make things easy on the surface.”
YouTube Unverified1 source· Talk
- usesSync State uses Redux
“Sync State is based on Redux. It uses Redux internally”
YouTube Unverified1 source· Talk





