|
| 1 | +--- |
| 2 | +title: Offsync |
| 3 | +description: Enable local-first applications with automatic data synchronization between edge devices and SQLite Cloud. |
| 4 | +category: platform |
| 5 | +status: publish |
| 6 | +slug: offsync |
| 7 | +--- |
| 8 | + |
| 9 | +import Callout from "@commons-components/Information/Callout.astro"; |
| 10 | + |
| 11 | +Offsync is a powerful SQLite Cloud feature that enables true **local-first** data synchronization for your applications. Powered by the [SQLite Sync](https://github.com/sqliteai/sqlite-sync) extension, it allows you to build robust, offline-capable applications where data is stored and processed on edge devices and seamlessly synchronized with a central SQLite Cloud database. |
| 12 | + |
| 13 | +This architecture is ideal for mobile apps, IoT devices, and any application requiring high availability and low latency, even with intermittent network connectivity. By leveraging Conflict-free Replicated Data Types (CRDTs), Offsync ensures that changes made offline are merged automatically and without conflicts when the device reconnects. |
| 14 | + |
| 15 | +## How It Works |
| 16 | + |
| 17 | +Offsync extends standard SQLite tables with built-in support for offline work and automatic synchronization. This allows multiple devices to operate independently and then seamlessly merge their changes. |
| 18 | + |
| 19 | +- **Offline-First by Design**: Applications work seamlessly even when devices are offline. Changes are queued locally and synced automatically when connectivity is restored. |
| 20 | +- **CRDT-Based Conflict Resolution**: Merges updates deterministically and efficiently, ensuring eventual consistency across all replicas without complex merge logic. |
| 21 | +- **Seamless Integration**: The sync layer is tightly integrated with SQLite Cloud, enabling secure data sharing across devices, users, and platforms. |
| 22 | + |
| 23 | +When combined with [Row-Level Security (RLS)](/docs/rls), Offsync allows you to build secure, multi-tenant applications where each user's data is safely isolated, both on the edge and in the cloud. |
| 24 | + |
| 25 | +## Configuring Offsync |
| 26 | + |
| 27 | +You can enable and manage Offsync for your databases directly from the SQLite Cloud dashboard. |
| 28 | + |
| 29 | +1. **Navigate to the Databases Page**: From the main dashboard, go to the "Databases" page. |
| 30 | +2. **Select the Offsync Column**: In the list of your databases, click on the button in the "Offsync" column for the desired database. |
| 31 | + |
| 32 | +  |
| 33 | + |
| 34 | +3. **Enable Tables for Synchronization**: On the Offsync settings page, you will see a list of all tables in your database. Toggle the switch next to each table you want to enable for synchronization. |
| 35 | + |
| 36 | +  |
| 37 | + |
| 38 | +<Callout type="note" title="Matching Schemas and Tables"> |
| 39 | +For Offsync to work correctly, the list of tables configured for synchronization—and their corresponding schemas—must be identical in both your local SQLite database and your SQLite Cloud database. |
| 40 | +</Callout> |
| 41 | + |
| 42 | +Once enabled, any changes made to the selected tables via the SQLite Sync extension will be automatically synchronized with your SQLite Cloud database. |
0 commit comments