You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Enable offline synchronization of data between your apps and Appwrite Databases.
5
+
---
6
+
7
+
Offline synchronization (or offline sync) is a mechanism that allows apps to store and update data locally when a user is offline (i.e., loses internet connectivity), and then synchronize that data with an Appwrite database once the user is back online.
8
+
9
+
This capability is crucial for building resilient and responsive applications, especially in environments with unreliable or intermittent internet connectivity. Some real-world scenarios where offline sync is useful are:
The process of implementing offline sync in Appwrite-powered apps (and in general) is as follows:
40
+
41
+
1. **Local data storage:** When a user opens your app, the app downloads relevant data from the server and saves it locally on their device via local-first data stores like IndexedDB, LocalStorage, SQLite, or RxDB.
42
+
43
+
2. **Working offline**: While offline, users can either read previously synced data or make changes (create, update, or delete data) in the local data store.
44
+
45
+
3. **Detecting connectivity**: The app monitors network status. As soon as connectivity is restored, a sync operation is triggered between the local data store and the Appwrite database.
46
+
47
+
5. **Two-way synchronization**: Local changes are *"pushed"* to the Appwrite database and new changes from the database are *"pulled"* into the local store. This process is called **push-pull replication**.
48
+
49
+
6. **Conflict resolution**: If the same data was changed both locally and on the server, the system must prioritise one of the two operations. Various strategies can be implemented to mitigate this issue, such as *last write wins* or *manual user conflict resolution*.
0 commit comments