LibSQL (Turso)
SQLite driver for Turso and libSQL
Installation
pnpm add @libsql/client
Configuration
import { createClient } from "viborm/libsql";
const client = createClient({
databaseUrl: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
schema,
});
Options
| Option | Type | Description |
|---|---|---|
client |
Client |
Existing libSQL client |
databaseUrl |
string |
Database URL (Turso cloud or local file) |
dataDir |
string |
Local file path (alternative to databaseUrl) |
authToken |
string |
Authentication token for Turso |
options |
Config |
Additional libSQL configuration |
Local Development
import { createClient } from "viborm/libsql";
// In-memory database (default)
const client = createClient({
schema,
});
// Local file with dataDir
const client = createClient({
dataDir: "./local.db",
schema,
});
// Or with databaseUrl
const client = createClient({
databaseUrl: "file:./local.db",
schema,
});
Turso Cloud
import { createClient } from "viborm/libsql";
const client = createClient({
databaseUrl: "libsql://your-database.turso.io",
authToken: process.env.TURSO_AUTH_TOKEN,
schema,
});
Transactions
LibSQL supports full transactions with savepoints for nested transactions — see Transactions.
Limitations
- SQLite dialect - no
LATERALjoins, limitedFULL OUTER JOIN - JSON columns return as strings and are parsed automatically
- Boolean values stored as integers (0/1)