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

@better-iam/adapter-sqlite

v0.2.0

Published

SQLite storage adapter for Better IAM, built on Kysely and better-sqlite3.

Readme

@better-iam/adapter-sqlite

SQLite persistence for Better IAM, using Kysely and better-sqlite3. Requires Node.js 22.12 or later. Install better-iam to receive this adapter with the complete distribution, or install this package directly.

import { sqliteAdapter } from '@better-iam/adapter-sqlite';

const database = sqliteAdapter({ filename: './iam.sqlite' });
await database.migrate();
// Pass database to betterIam({ database, ... }).

filename accepts a filesystem path or :memory: for tests. URI filenames are unsupported. The containing directory must already exist. busyTimeoutMs defaults to 5000 and can be set between 0 and 60000.

All writes require database.transaction(async tx => ...). Read/modify/write sequences must run inside this callback, including all reads used to make a write decision. Nested transactions on the same adapter join the outer transaction; a failed nested operation marks the entire transaction for rollback. Retaining a transaction handle after its callback completes is unsupported and rejected. Do not start a second adapter's transaction from inside the first adapter's transaction on the same database.

The adapter acquires BEGIN IMMEDIATE before application reads and retains one connection across await. Operations on adapters addressing the same canonical filename serialize through a shared process mutex. SQLite's database locks coordinate other processes, with a bounded busy timeout. Use one canonical path per database; aliases through filesystem hard links or independently loaded worker runtimes cannot share the process mutex. Do not perform network requests or long work inside database transactions.

Records use the same schema and strict JSON filter semantics as the PostgreSQL adapter. Natural keys are unique within collection and tenant. put updates existing records and cannot change tenant ownership. Filter results sort by record ID before pagination, independent of database collation. Tenant and record ID predicates use database indexes; remaining JSON filters execute in application code. This initial adapter favors consistency over high-volume analytical query performance.

migrate() is idempotent and checks the persisted schema version. Back up the database before upgrades. close() releases the database handle. Never call close() from inside a transaction. Database uniqueness errors expose IamError code CONFLICT; lock timeouts expose STORAGE_BUSY. Retry the entire operation after a busy response, not an isolated write.

The shared generic record schema intentionally has no application-level foreign keys. Better IAM services validate tenant hierarchy, identity ownership, and references within transactions. Writing database records directly bypasses service-level authorization and referential checks.

License: Apache-2.0.