{"id":46584,"library":"tauri-plugin-sqlite-api","title":"Tauri Plugin SQLite API","description":"A Tauri plugin for SQLite databases based on Sqlx, currently at version 0.1.2. It provides a consistent API with the official Tauri SQL plugin but exclusively supports SQLite, with additional support for SQLite extensions. The package is actively maintained with regular updates. It is designed for Tauri v2 and offers both Rust and frontend APIs for database operations like load, execute, select, and close, with automatic resource cleanup.","status":"active","version":"0.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/return764/tauri-plugin-sqlite","tags":["javascript","tauri","plugin","sqlite","typescript"],"install":[{"cmd":"npm install tauri-plugin-sqlite-api","lang":"bash","label":"npm"},{"cmd":"yarn add tauri-plugin-sqlite-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add tauri-plugin-sqlite-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Rust crate that provides the core plugin implementation; the frontend API package depends on it for functionality","package":"tauri-plugin-sqlite","optional":true}],"imports":[{"note":"Package uses ESM; CommonJS require may cause issues in module-based projects","wrong":"const load = require('tauri-plugin-sqlite-api').load","symbol":"load","correct":"import { load } from 'tauri-plugin-sqlite-api'"},{"note":"Commonly confused with the official Tauri SQL plugin; ensure correct package name","wrong":"import { execute } from '@tauri-apps/plugin-sql'","symbol":"execute","correct":"import { execute } from 'tauri-plugin-sqlite-api'"},{"symbol":"select","correct":"import { select } from 'tauri-plugin-sqlite-api'"},{"symbol":"close","correct":"import { close } from 'tauri-plugin-sqlite-api'"},{"note":"No default export; all functions are named exports. Using default import will result in undefined","wrong":"import Database from 'tauri-plugin-sqlite-api'","symbol":"load, execute, select, close","correct":"import { load, execute, select, close } from 'tauri-plugin-sqlite-api'"}],"quickstart":{"code":"import { load, execute, select, close } from 'tauri-plugin-sqlite-api';\n\n// Load the database\nconst db = await load({ db_url: 'sqlite:test.db' });\n\n// Execute an INSERT\nconst result = await execute(db, 'INSERT INTO users (name) VALUES (?)', ['John']);\nconsole.log(result); // { rowsAffected: 1, lastInsertId: 1 }\n\n// Query data\nconst rows = await select(db, 'SELECT * FROM users WHERE name = ?', ['John']);\nconsole.log(rows); // [{ id: 1, name: 'John' }]\n\n// Close the connection\nawait close(db);","lang":"typescript","description":"Demonstrates loading a SQLite database, executing an insert, selecting rows with placeholders, and closing the connection."},"warnings":[{"fix":"Use `load({ db_url: 'sqlite:test.db' })` instead of `load('sqlite:test.db')`.","message":"The `load` function expects an object with `db_url` property, not a plain string.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Pin exact version in package.json or use lockfile. Check changelog before upgrading.","message":"Package version 0.x may have breaking changes in minor releases as it is pre-1.0.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Ensure your Tauri app is using v2 (tauri 2.x).","message":"The plugin requires Tauri v2; it is not compatible with Tauri v1.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always call `await close(db)` when done, or use the automatic resource cleanup provided by Tauri if configured.","message":"Resource lifecycle: the `db` object returned by `load` must be closed manually with `close(db)` to avoid memory leaks.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use ES module imports (import { ... } from 'tauri-plugin-sqlite-api').","message":"Using `require` syntax with this package may trigger warnings or errors in newer Node/Tauri versions.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.2':17 'activ':42 'addit':34 'api':4,22,59 'automat':70 'base':11 'cleanup':72 'close':68 'consist':21 'current':14 'databas':10,61 'design':49 'exclus':30 'execut':65 'extens':38 'frontend':58 'javascript':73 'like':63 'load':64 'maintain':43 'offer':54 'offici':25 'oper':62 'packag':40 'plugin':2,7,28,75 'provid':19 'regular':45 'resourc':71 'rust':56 'select':66 'sql':27 'sqlite':3,9,32,37,76 'sqlx':13 'support':31,35 'tauri':1,6,26,51,74 'typescript':77 'updat':46 'v2':52 'version':16","created_at":"2026-06-07T13:00:38.398692+00:00","updated_at":"2026-06-07T13:00:38.398692+00:00","problems":[{"fix":"Use named import: `import { load } from 'tauri-plugin-sqlite-api'`.","cause":"Importing the package incorrectly, e.g., using default import or CommonJS require that doesn't match exported members.","error":"TypeError: load is not a function"},{"fix":"Run `npm install tauri-plugin-sqlite-api` and ensure tsconfig.json has `\"moduleResolution\": \"node\"` or `\"nodenext\"`.","cause":"Package not installed or TypeScript configuration missing module resolution for node_modules.","error":"Error: Cannot find module 'tauri-plugin-sqlite-api' or its corresponding type declarations."},{"fix":"Add `.plugin(tauri_plugin_sqlite::Builder::default().build())` in your Rust main function.","cause":"The Rust plugin `tauri-plugin-sqlite` is not registered in the Tauri builder.","error":"Uncaught (in promise) TauriError: Plugin not found: sqlite"},{"fix":"Ensure `db_url` is a string like `'sqlite:test.db'`.","cause":"Passing an invalid or malformed `db_url` to the `load` function.","error":"Error: db_url must be a string starting with 'sqlite:'"},{"fix":"Run a migration in Rust to create the necessary tables, or execute a CREATE TABLE statement first.","cause":"The table has not been created before running the select or execute query.","error":"Error: SQLite error: no such table: users"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/return764/tauri-plugin-sqlite#readme","github":"https://github.com/return764/tauri-plugin-sqlite","docs":null,"changelog":null,"pypi":null,"npm":"tauri-plugin-sqlite-api","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}