DATE:
AUTHOR:
PowerSync Product Team
JavaScript/Web SDK Rust SDK Tauri SDK

Introducing the PowerSync Tauri SDK (Alpha)

DATE:
AUTHOR: PowerSync Product Team

We've released a native Tauri SDK into alpha.

Tauri is a popular Electron alternative that uses web technologies for the UI and Rust for the backend, making it a good fit for PowerSync's JavaScript APIs and native Rust functionality we already have.

While it was possible to use the PowerSync Web SDK in a Tauri app, you likely ran into issues: IndexedDB and OPFS don't persist across app updates in Tauri's WebView - the database resets on every new build, losing any unsynced writes. And WASM SQLite undercuts the performance that Tauri users are typically trying to achieve. This SDK replaces both with filesystem-based SQLite storage backed by native Rust. In practice, that means:

  • Data persists reliably on the filesystem, surviving app updates

  • Native SQLite performance without WASM overhead

  • Sync state, watched queries, and table updates are shared across all windows automatically

SDK overview

The SDK consists of two packages:

  • tauri-plugin-powersync: a Rust crate that handles all database state: SQLite connections, sync, and broadcasting updates across windows

  • @powersync/tauri-plugin: the JavaScript package that exposes the standard PowerSync API to your frontend code

The Rust layer handles database persistence and state, and coordinates this across your app, including across multiple windows. Watched queries, table updates, and sync status are all shared across windows automatically.

The JavaScript layer exposes the same APIs as the PowerSync Web SDK, so if you've already built with PowerSync on the web, the JavaScript side will feel familiar.

Getting started

Install the JavaScript package:

npm install @powersync/tauri-plugin

Add the Rust crate to your src-tauri:

cargo add tauri-plugin-powersync

In src-tauri/capabilities/default.json, add powersync:default under permissions. Then load the plugin in lib.rs:

pub fn run() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![connect])
        .plugin(tauri_plugin_powersync::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Then create a PowerSyncTauriDatabase in your app:

import { PowerSyncTauriDatabase } from '@powersync/tauri-plugin';
import { appDataDir } from '@tauri-apps/api/path';

import { AppSchema } from './AppSchema';

export const db = new PowerSyncTauriDatabase({
  // The schema you defined in the previous step
  schema: AppSchema,
  database: {
    // Filename for the SQLite database.
    dbFilename: 'powersync.db',
    // An optional directory to store the database file in.
    dbLocationAsync: appDataDir,
  }
});

For full setup instructions, see the Tauri SDK docs. The JavaScript API is shared with the Web SDK, so the JavaScript Web SDK docs cover further details.

Demo

A demo app is available at demos/tauri-app: a minimal todo app showing Sync Streams, sync status, and live queries synced across multiple independent windows.

Current limitations

Connecting from JavaScript is not yet supported. Calling db.connect() from JavaScript will throw on error. To connect, pass a database handle to Rust and call connect() there — which also means implementing your backend connector in Rust. This is a deliberate trade-off: keeping the sync connection in Rust is what enables reliable cross-window coordination. We plan to address this in a future release.

Some sync status fields are unavailable. lastSyncedAt, hasSynced, and priorityStatusEntries are not available on SyncStatus. Use the status provided via Sync Streams through SyncStatus.forStream instead.

Alpha status

This SDK is alpha: it is not production-ready, APIs may change, and breaking changes can occur without notice. It is built on our Rust SDK, which is also in an alpha state. The JavaScript API matches our other SDKs and is stable, but the overall SDK - including the Rust layer and the IPC protocol between the JS and Rust packages - is subject to change at this stage.

Feedback and help

Because this SDK is in alpha, your feedback is especially valuable. It directly shapes what we fix and prioritize next. If you run into a bug or limitation, or have thoughts on the API, please share them in Discord or GitHub.

Also, a shoutout to @MrLightful, whose community example helped motivate this work 🫡

Powered by LaunchNotes