@libsql/client

libSQL driver for TypeScript and JavaScript

@libsql/client downloads @libsql/client version @libsql/client license

@libsql/clientSimilar Packages:

Npm Package Weekly Downloads Trend

3 Years
๐ŸŒŸ Show real-time usage chart on @libsql/client's README.md, just copy the code below.
## Usage Trend
[![Usage Trend of @libsql/client](https://npm-compare.com/img/npm-trend/THREE_YEARS/@libsql/client.png)](https://npm-compare.com/@libsql/client#timeRange=THREE_YEARS)

Cumulative GitHub Star Trend

๐ŸŒŸ Show GitHub stars trend chart on @libsql/client's README.md, just copy the code below.
## GitHub Stars Trend
[![GitHub Stars Trend of @libsql/client](https://npm-compare.com/img/github-trend/@libsql/client.png)](https://npm-compare.com/@libsql/client)

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
@libsql/client0547140 kB11712 days agoMIT

README for @libsql/client

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

Looking for the Turso serverless package? Check out @tursodatabase/serverless โ€” the lightest option with zero native dependencies, and will be the driver to later support concurrent writes. Use @libsql/client if you need a battle-tested driver today with ORM integration.

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