| title | OffSync |
|---|---|
| description | Enable local-first applications with automatic data synchronization between edge devices and SQLite Cloud. |
| category | platform |
| status | publish |
| slug | offsync |
import VideoPlayer from '@commons-components/Video/VideoPlayer.astro'; import enableSync from '@docs-website-assets/introduction/video/dashboard_sqlite_sync_enabling.mp4'; import connectionUrlSync from '@docs-website-assets/introduction/video/dashboard_sync_connection_url.mp4'; import devicesSync from '@docs-website-assets/introduction/video/dashboard_sync_devices.mp4';
import Callout from "@commons-components/Information/Callout.astro";
OffSync is a powerful SQLite Cloud feature that enables true local-first data synchronization for your applications. Powered by the 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.
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.
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.
- Offline-First by Design: Applications work seamlessly even when devices are offline. Changes are queued locally and synced automatically when connectivity is restored.
- CRDT-Based Conflict Resolution: Merges updates deterministically and efficiently, ensuring eventual consistency across all replicas without complex merge logic.
- Seamless Integration: The sync layer is tightly integrated with SQLite Cloud, enabling secure data sharing across devices, users, and platforms.
When combined with Row-Level Security (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.
You can enable and manage OffSync for your databases directly from the SQLite Cloud dashboard.
Below are the main steps:
From the Sync Tables tab, select which tables in your database you want to keep synchronized.
Once enabled, all changes to those tables will automatically sync with connected devices.
In the Configuration tab, copy the connection string.
Use this in your application to initialize OffSync and connect your local SQLite database with SQLite Cloud.
In the Devices tab, you can view all devices currently connected to your database.
Here you can check their sync status and remove devices if needed.
Once enabled, any changes made to the selected tables via the SQLite Sync extension will be automatically synchronized with your SQLite Cloud database.