This repository contains an example for a Feathers API with full offline-first capabilities. It comes in several components:
Install all the dependencies in the monorepo with
npm install
When using Visual Studio Code, all the below commands will be started automatically.
Start the local MongoDB server with
docker compose up
This is a standard Feathers 5 API with websockets enabled and a todos
service as well as a sync
service which stores information about the synced documents (e.g. Automerge document IDs, service path and channel).
Run it with
cd server
npm run dev
This is the synchronization server that connects to the server
API and handles the synchronization of the documents.
Run it with
cd sync-server
npm start
On first start it will initialise an Automerge document for the todos
service on the default channel.
The frontend is a simple Todo app using VueJS and a Feathers client with websockets enabled and a todos
service.
Run it with:
cd frontend
npm run dev
Then go to localhost:5173.
The goal of this project is to add full offline-first capabilities to a Feathers API.
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
Several local-first synchronization options were evaluated, however, most rely on (Postgre)SQL or paid infrastructure.

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