百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

state

> 编程语言
开源

基于 Redux 的本地优先软件状态容器,提供使用 Automerge CRDT 实现无缝同步。 (原名为 Cevitxe)。

196 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

基于 Redux 的本地优先软件状态容器,提供使用 Automerge CRDT 实现无缝同步。 (原名为 Cevitxe)。

@localfirst/state is an automatically replicated Redux store that gives your app offline capabilities and secure peer-to-peer synchronization superpowers.

Work in progress

Why

Distributed, offline-first technologies are promising for a lot of reasons, but they're unfamiliar to most web application developers. This library provides offline storage and peer-to-peer synchronization capabilities, and exposes them via a familiar Redux store that can be used in a vanilla JS, React, or Electron application.

Read more

What

This library provides two services:

  • Data replication & synchronization, using the Automerge library
  • Persistence to a local or remote data store. You can use the provided adapters for IndexedDb or MongoDb, or provide your own.

Read more

How

Example apps

Two demo React applications are included:

todo

An implementation of TodoMVC

To run: yarn dev:todo:start

grid

A simple table editor

To run: yarn dev:grid:start

Getting started

bash
yarn add @localfirst/state
javascript
import { StoreManager } from '@localfirst/state'
import { Provider } from 'react-redux'

const storeManager = new StoreManager({
  // Pass your reducers
  proxyReducer,

  // Pass an initial state, just like you would for Redux
  initialState: {
    todoList: [],
    todoMap: {},
    filter: ALL,
  },
})

export const Index = () => {
  // Obtain a Redux store
  const store = storeManager.createStore(discoveryKey)
  return (
    // Pass the store to your app
    
      
    
  )
}

More on how to use @localfirst/state in your app

Limitations

This library requires that the entire repository be present on each peer's machine. That means that it is limited to datasets that can fit comfortably within the disk space on a single computer. In 2019, that means something on the order of 1-10 GB.

Further reading

  • CRDTs and the Quest for Distributed Consistency, a great talk by Martin Kleppman, the author of Automerge.
  • Local-first software: You own your data, in spite of the cloud, a manifesto published by Ink & Switch, the industrial research lab created by Heroku alumni that is behind Automerge.
  • A web application with no web server?

Alternatives

All of these projects are working in similar problem space, in JavaScript. All work in Node.js and the browser unless otherwise noted.

  • Hypermerge is the semi-official networking and persistence stack for Automerge, based on the DAT project's Hypercore and created by the team at Ink and Switch. It's used in sample Automerge applications like Capstone and Farm. Node.js only.
  • PouchDb Syncs with Apache CouchDb.
  • Realm Database Acquired by MongoDB in 2019. Node.js only.
  • HyperDB From the DAT Project. Showcased in a cool sample app by @jimpick: Dat Shopping List.
  • GunDB Distributed graph database.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptautomergecrdtlocal-firstoffline

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言