You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@libsql/client

Package Overview
Dependencies
Maintainers
3
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libsql/client

libSQL driver for TypeScript and JavaScript

0.15.10
latest
Source
npmnpm
Version published
Weekly downloads
239K
10.9%
Maintainers
3
Weekly downloads
 
Created
Source

libSQL TypeScript

libSQL TypeScript

Databases for all TypeScript and JS multi-tenant apps.

Turso · Docs · Quickstart · SDK Reference · Blog & Tutorials

MIT License Discord Contributors Weekly downloads Examples

Features

Install

npm install @libsql/client

Quickstart

The example below uses Embedded Replicas and syncs every minute from Turso.

import { createClient } from "@libsql/client";

export const turso = createClient({
    url: "file:local.db",
    syncUrl: process.env.TURSO_DATABASE_URL,
    authToken: process.env.TURSO_AUTH_TOKEN,
    syncInterval: 60000,
});

await turso.batch(
    [
        "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)",
        {
            sql: "INSERT INTO users(name) VALUES (?)",
            args: ["Iku"],
        },
    ],
    "write",
);

await turso.execute({
    sql: "SELECT * FROM users WHERE id = ?",
    args: [1],
});

Examples

ExampleDescription
localUses libsql with a local SQLite file. Creates database, inserts data, and queries.
remoteConnects to a remote database. Requires environment variables for URL and auth token.
syncDemonstrates synchronization between local and remote databases.
batchExecutes multiple SQL statements in a single batch operation.
transactionsShows transaction usage: starting, performing operations, and committing/rolling back.
memoryUses an in-memory SQLite database for temporary storage or fast access.
vectorWorks with vector embeddings, storing and querying for similarity search.
encryptionCreates and uses an encrypted SQLite database, demonstrating setup and data operations.
ollamaSimilarity search with Ollama and Mistral.

Documentation

Visit our official documentation.

Support

Join us on Discord to get help using this SDK. Report security issues via email.

Contributors

See the contributing guide to learn how to get involved.

Contributors

good first issue

Keywords

libsql

FAQs

Package last updated on 16 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts