TypeScript icon, indicating that this package has built-in type declarations

0.7.0 • Public • Published

SyncState Logo SyncState

SyncState is a document-based state management library for JS apps that can power realtime multi-user, offline-first, undoable states across systems.

  • Elegant on the surface, yet scales to large apps.
  • Based on JSON patches.
  • Plugins for History, Multi-user and more.
  • Powered by Redux and Immer


Find Complete Documentation here

Functional at the core. Mutate on the surface.

JSON patches as actions which can be transferred between the threads and sessions. Supports local mutation with Immer.js.

Like Redux, like MobX

The state is functional but the internal reactivity is based on the MobX approach.

Undo / Redo plugin

A plugin that stores the changes as JSON patches (instead of a series of app snapshots).

Easily build multiuser apps

The remote plugin helps achieve multiuser functionality. It comes with a bit of server piece that works for conflict resolution.



Have something to add? We are lucky to have you, head over to Contribution Guidelines and learn how you can be a part of a wonderful growing community of SyncState.


You can install @syncstate/core for the core functionality as a package from NPM.

npm install @syncstate/core --save

# Yarn
yarn add @syncstate/core

The recommended way to use SyncState with React is to use @syncstate/react. It has a hook for reactive updates and a Provider component to make the store available to the whole app.

npm install @syncstate/react --save

# Yarn
yarn add @syncstate/react

Both packages are available as CJS as well as ESM packages. The source code is written in TypeScript and the published code is compiled to ES5 for compatibility across older browsers.

Counter example

import { createDocStore } from '@syncstate/core';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Provider, useDoc } from '@syncstate/react';

// Create a store with an initial state
const store = createDocStore({ counter: 0 });

// Wrap your App with Provider and pass the store prop
  <Provider store={store}>
    <App />

function App() {
   * useDoc hook with no arguments returns the root document and the function to modify the document.
   * This also adds a listener at the document root and updates the component
   * when the document changes.
  const [doc, setDoc] = useDoc();

  const increment = () => {
    setDoc((doc) => {
      // This looks like a mutation but here we are updating the draft state
      // using Immer.js which generates JSON patches for our internal reducers.

  const decrement = () => {
    setDoc((doc) => {

  return (
      <button onClick={decrement}>-</button>
      <button onClick={increment}>+</button>

Watch the introductory talk about SyncState at React Native EU 2020

introductory talk about SyncState

Built with ❤️   at GeekyAnts.

Authors :


Licensed under the MIT License, Copyright © 2020 SyncState. See LICENSE for more information.




Package Sidebar


npm i @syncstate/core

Weekly Downloads






Unpacked Size

170 kB

Total Files


Last publish


  • sanketsahu
  • himanshu-satija