Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
RemoteLibSQL
✓ import { RemoteLibSQL } from 'remote-sql-libsql'
✗ const RemoteLibSQL = require('remote-sql-libsql');
// Wrong: CommonJS require does not work with named exports in this ESM-first library
Named export; library requires ESM. Default import not available.
LibSQLPreparedStatement
✓ import { LibSQLPreparedStatement } from 'remote-sql-libsql'
✗ import { PreparedStatement } from 'remote-sql-libsql';
// Wrong: symbol is LibSQLPreparedStatement, not PreparedStatement
TypeScript type; exported alongside RemoteLibSQL.
RemoteSQL interface
✓ import type { RemoteSQL } from 'remote-sql'
✗ import { RemoteSQL } from 'remote-sql-libsql';
// Wrong: the interface is defined in remote-sql package, not this implementation
For type alignment, import the RemoteSQL interface from the main remote-sql package.
Demonstrates creating a RemoteLibSQL instance from a Turso client, preparing and executing a query, and running a batch transaction.
import { RemoteLibSQL } from 'remote-sql-libsql';
import { createClient } from '@libsql/core';
const client = createClient({
url: process.env.TURSO_DATABASE_URL ?? 'libsql://your-database.turso.io',
authToken: process.env.TURSO_AUTH_TOKEN ?? ''
});
const rls = new RemoteLibSQL(client);
const stmt = rls.prepare('SELECT name FROM users WHERE id = ?');
const result = await stmt.bind(1).all<{ name: string }>();
console.log(result);
// Batch transaction
const insert1 = rls.prepare('INSERT INTO users (name) VALUES (?)').bind('Alice');
const insert2 = rls.prepare('INSERT INTO users (name) VALUES (?)').bind('Bob');
const batchResults = await rls.batch([insert1, insert2]);
console.log(batchResults);
Errors
Common errors & fixes
RemoteLibSQL is not a constructor
Importing as default instead of named export.
fixUse import { RemoteLibSQL } from 'remote-sql-libsql' Missing package: @libsql/core
Peer dependency not installed.
fixInstall @libsql/core: pnpm add @libsql/core
TypeError: Cannot read properties of undefined (reading 'prepare')
Client passed to RemoteLibSQL constructor is undefined or invalid.
fixEnsure createClient() returns a valid Client object before constructing RemoteLibSQL.
Method 'query' does not exist
Trying to call .query() which was removed in favor of .all().
fixUse .all<T>() instead of .query<T>().
Audit
Dependencies
@libsql/corerequiredPeer dependency: provides the underlying LibSQL client needed to instantiate RemoteLibSQL