npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tanstack/tauri-db-sqlite-persistence

v0.1.5

Published

Tauri SQLite persisted collection adapter for TanStack DB

Downloads

301

Readme

@tanstack/tauri-db-sqlite-persistence

Thin SQLite persistence for Tauri apps using @tauri-apps/plugin-sql.

Public API

  • createTauriSQLitePersistence(...)
  • persistedCollectionOptions(...) (re-exported from core)

Install

pnpm add @tanstack/tauri-db-sqlite-persistence @tauri-apps/plugin-sql

Consumer-side Tauri setup

Install the official SQL plugin in your Tauri app:

cd src-tauri
cargo add tauri-plugin-sql --features sqlite

Register the plugin in src-tauri/src/main.rs:

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_sql::Builder::default().build())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Enable the SQL permissions in src-tauri/capabilities/default.json:

{
  "permissions": ["core:default", "sql:default", "sql:allow-execute"]
}

Quick start

import Database from '@tauri-apps/plugin-sql'
import { createCollection } from '@tanstack/db'
import {
  createTauriSQLitePersistence,
  persistedCollectionOptions,
} from '@tanstack/tauri-db-sqlite-persistence'

type Todo = {
  id: string
  title: string
  completed: boolean
}

const database = await Database.load(`sqlite:tanstack-db.sqlite`)

const persistence = createTauriSQLitePersistence({
  database,
})

export const todosCollection = createCollection(
  persistedCollectionOptions<Todo, string>({
    id: `todos`,
    getKey: (todo) => todo.id,
    persistence,
    schemaVersion: 1,
  }),
)

Notes

  • createTauriSQLitePersistence is shared across collections.
  • Reuse a single Database.load('sqlite:...') handle per SQLite file when using this package. Opening multiple plugin handles to the same file can reintroduce SQLite locking behavior outside this package's serialized transaction queue.
  • Mode defaults (sync-present vs sync-absent) are inferred from whether a sync config is present in persistedCollectionOptions.
  • This package expects a database handle created by @tauri-apps/plugin-sql, typically from Database.load('sqlite:...').
  • The database path is resolved by Tauri's SQL plugin, not by this package.
  • This package does not publish or require package-specific Rust code. Only the app-level Tauri SQL plugin registration shown above is required.

Testing

  • pnpm --filter @tanstack/tauri-db-sqlite-persistence test runs the driver and shared adapter contract tests.
  • pnpm --filter @tanstack/tauri-db-sqlite-persistence test:e2e builds the repo-local Tauri harness and runs the persisted collection conformance suite inside a real Tauri runtime.