Skip to content

kalisio/offline-sync

Repository files navigation

Feathers Offline Synchronization

Packages for integrating Feathers API and client applications with Automerge for offline capabilities and server to server synchronization:

  • @kalisio/feathers-automerge: A service implementation on top of the Automerge CRDT as well as a client for offline synchronization with a feathers-automerge-server. Read the full documentation here.
  • @kalisio/feathers-automerge-server: Integrates an Automerge sync server into an existing Feathers server and synchronizes offline documents with clients and other servers. Read the full documentation here.

Example

This repository contains an example for a Feathers API with full offline-first capabilities. It comes in several components:

Installation

Install all the dependencies in the monorepo with

git clone git@github.com:kalisio/offline-sync.git
cd offline-sync
yarn install

Running the example

With Docker running, the development system can be started like this

yarn run dev

Then go to http://localhost:5173. The API server is running at http://localhost:3030.

To run another server to test server to server synchronization in a new terminal run:

yarn run s2s

It will be available at http://localhost:5050.

Goal

The goal of this project is to add full offline-first capabilities to a Feathers API.

Automerge Snapshots

In order to flexibly add offline capabilities we are proposing the following structure:

graph TD
  FA[Feathers API/Database] -->|Events/Logs| SN[Snapshot Server]
  SN <-->|Syncs| C1
  C1[Client] -->|Creates Snapshot| SN
  SN --> |Updates| FA
Loading

Alternatives

Several local-first synchronization options were evaluated, however, most rely on (Postgre)SQL or paid infrastructure.

local-first-projects

Limitations

  • Soft delete
  • Run hooks (keep separate snapshot of server "view" and client changes)

About

Feathers Offline Synchronization

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •