Files
turso/packages/turso-sync-js
2025-08-12 18:52:58 +04:00
..
2025-08-08 15:44:41 +04:00
2025-08-08 15:44:41 +04:00
2025-08-08 15:44:42 +04:00
2025-08-08 15:44:42 +04:00
2025-08-08 15:44:41 +04:00
2025-08-08 15:44:42 +04:00
2025-08-08 15:44:42 +04:00
2025-08-08 16:40:19 +04:00
2025-08-12 17:01:47 +03:00
2025-08-12 18:52:58 +04:00
2025-08-08 16:40:19 +04:00
2025-08-08 15:44:42 +04:00
2025-08-08 15:44:42 +04:00
2025-08-08 15:44:41 +04:00
2025-08-08 15:44:41 +04:00
2025-08-08 16:40:19 +04:00

turso-sync-js package

Warning

@tursodatabase/sync is in a very experimental stage. It may cause data corruption in both local and remote databases.

We are actively working to make it a production-grade package, but it is not safe for critical data yet.

Usage

npm i @tursodatabase/sync

Example usage with remote DB hosting at Turso Cloud

import { connect } from '@tursodatabase/sync';

const db = await connect({
    path: 'local.db',                // path used as a prefix for local files created by sync-engine
    url: 'https://<db>.turso.io',    // URL of the remote database: turso db show <db>
    authToken: '...',                // auth token issued from the Turso Cloud: turso db tokens create <db>
    clientName: 'turso-sync-example' // arbitrary client name
});

// db has same functions as Database class from @tursodatabase/database package but adds few more methods for sync:
await db.pull(); // pull changes from the remote
await db.push(); // push changes to the remote
await db.sync(); // pull & push changes