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

turbolite

v0.5.0

Published

turbolite -- SQLite with compressed page groups and optional S3 cloud storage. Returns standard better-sqlite3 connections.

Readme

turbolite

SQLite for Node.js with compressed page groups and optional S3 cloud storage. Returns standard better-sqlite3 connections with full API: prepared statements, param binding, transactions, user-defined functions, aggregates, and more.

Install

npm install turbolite

The postinstall script patches better-sqlite3 to enable URI filename support (SQLITE_USE_URI=1) and rebuilds from source. This is required for VFS selection via URI.

Usage

Local mode (compressed, file-first)

const turbolite = require('turbolite');

// /data/app.db is the user-visible local page image (turbolite-owned).
// /data/app.db-turbolite/ holds hidden implementation state
// (manifest, cache, staging logs).
const db = turbolite.connect('/data/app.db');

// Full better-sqlite3 API: prepared statements, param binding, transactions
const insert = db.prepare('INSERT INTO users (name, age) VALUES (?, ?)');
insert.run('alice', 30);
insert.run('bob', 25);

const rows = db.prepare('SELECT * FROM users WHERE age > ?').all(20);
// [{ id: 1, name: 'alice', age: 30 }, { id: 2, name: 'bob', age: 25 }]

// Transactions
const batchInsert = db.transaction((users) => {
  for (const u of users) insert.run(u.name, u.age);
});
batchInsert([{ name: 'charlie', age: 35 }]);

db.close();

app.db is turbolite's compressed page image. It is not promised to be opened directly by stock SQLite. To produce a normal SQLite file the sqlite3 CLI can read, use better-sqlite3's online backup API:

await db.backup('/data/exported.sqlite');

(db.backup opens the destination via SQLite's default VFS, sidestepping the file-first VFS's identity check on alias opens.)

S3 cloud mode

Pages are compressed locally and durably synced to S3 (or any S3-compatible store).

const db = turbolite.connect('my.db', {
  mode: 's3',
  bucket: 'my-bucket',
  region: 'us-east-1',
});

With a custom S3-compatible endpoint (Tigris, MinIO, etc.):

const db = turbolite.connect('my.db', {
  mode: 's3',
  bucket: 'my-bucket',
  endpoint: 'https://fly.storage.tigris.dev',
  region: 'auto',
});

API

turbolite.connect(path, options?)

Open a database. Returns a standard better-sqlite3.Database.

  • path string -- Path to the database file.
  • options object -- Optional. Defaults to local compressed mode.

Options

| Option | Type | Default | Description | |---|---|---|---| | mode | 'local' \| 's3' | 'local' | Storage mode. | | bucket | string | -- | S3 bucket name (required for mode='s3'). | | endpoint | string | AWS S3 | Custom S3 endpoint URL. | | prefix | string | 'turbolite' | S3 key prefix. | | region | string | SDK default | AWS region. | | cacheDir | string | -- | Lower-level: override the sidecar location (default is <dbPath>-turbolite). Mostly useful in S3 mode. | | compressionLevel | number | 3 | Zstd compression level 1-22. | | readOnly | boolean | false | Open in read-only mode. | | pageCache | string | '64MB' | In-memory page cache size. Set to '0' to disable. |

turbolite.load(db)

Load the turbolite extension into an existing better-sqlite3 Database.

turbolite.stateDirForDatabasePath(dbPath)

Return the hidden sidecar directory path for a file-first database path. For /data/app.db this is /data/app.db-turbolite. Useful for tests or tooling that asserts on layout without hardcoding the suffix rule.

Architecture

Each connect() call creates an isolated VFS instance keyed to the caller's database path. The user-supplied path is the local page image; hidden implementation state lives at <dbPath>-turbolite/.

Under the hood:

  1. The turbolite loadable extension is loaded into better-sqlite3's SQLite
  2. turbolite_register_file_first_vfs(name, dbPath) creates a named VFS instance bound to that path
  3. The database is opened via URI: file:dbPath?vfs=turbolite-node-N
  4. PRAGMA cache_size=0 disables SQLite's cache (turbolite manages its own)

The lower-level turbolite_register_vfs(name, cacheDir) SQL function is still available for embedders that want turbolite to own a directory and store the local image at <cacheDir>/data.cache. New code should prefer the file-first form.

Build from source

cd packages/node

# Build the loadable extension (requires Rust)
npm run build-ext

# Install dependencies (patches + rebuilds better-sqlite3 for URI support)
npm install

# Run tests
npm test

Environment variables

| Variable | Description | |---|---| | TURBOLITE_EXT_PATH | Override path to the loadable extension binary | | TURBOLITE_DATABASE_PATH | File-first database path for the default "turbolite" VFS (extension-load time) | | TURBOLITE_BUCKET | S3 bucket name (S3 mode) | | TURBOLITE_REGION | AWS region (S3 mode) | | TURBOLITE_ENDPOINT_URL | Custom S3 endpoint URL (S3 mode) | | TURBOLITE_MEM_CACHE_BUDGET | Page cache size (default 64MB) | | TURBOLITE_COMPRESSION_LEVEL | Zstd level 1-22 (default 3) |