npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

knex-libsql-client

v0.1.1

Published

Knex dialect for @libsql/client — the only maintained asynchronous SQLite driver for Node.js.

Downloads

724

Readme

knex-libsql-client

A Knex dialect for @libsql/client, which is the only maintained async SQLite driver for Node.js.

Why async SQLite?

The established SQLite drivers for Node.js are either deprecated or synchronous:

  • sqlite3 (node-sqlite3) — deprecated and no longer maintained
  • better-sqlite3 — synchronous
  • Node.js built-in node:sqlite — synchronous

Synchronous access works fine when SQLite is used like a conventional relational database: a single file, text and numeric columns, no blobs, no large amounts of data. But SQLite can be used differently:

  • As a file container — storing images or binary assets directly in a database can be faster than the filesystem. Reading large blobs synchronously blocks the Node.js event loop.
  • Multi-tenant architectures — one database per customer is a natural fit for SQLite. A synchronous driver serializes all I/O across every concurrent request.

In these scenarios, blocking the event loop is not acceptable. @libsql/client is the only maintained driver that keeps all database I/O fully asynchronous.

Install

npm install knex @libsql/client knex-libsql-client

Usage

Local database:

import { createLibsqlKnex } from "knex-libsql-client";

const db = createLibsqlKnex({
  connection: {
    url: "file:./my.db",
    initCommands: ["PRAGMA foreign_keys = ON"],
  },
});

const rows = await db("users").select("*");

In-memory database:

const db = createLibsqlKnex({
  connection: {
    url: ":memory:",
    initCommands: ["PRAGMA foreign_keys = ON"],
  },
});

Remote database (Turso / LibSQL server):

const db = createLibsqlKnex({
  connection: {
    url: "libsql://your-db.turso.io",
    authToken: process.env.TURSO_AUTH_TOKEN,
    initCommands: ["PRAGMA foreign_keys = ON"],
  },
});

Connection options

| Option | Description | | --- | --- | | url | Database URL. Use file:./path/to/db.sqlite for a local file, :memory: for in-memory, or an https:// / wss:// URL for a remote LibSQL server (e.g. Turso). | | filename | Alternative to url for local files — converted to a file: URL automatically. | | authToken | Auth token for remote LibSQL connections. | | initCommands | Array of SQL statements to execute on each new connection, in order. Useful for PRAGMAs such as PRAGMA foreign_keys = ON. A failure in any command discards the connection. |

License

MIT