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

@intentface/latch-drizzle

v0.12.0

Published

Latch StorageAdapter on Drizzle (SQLite/libsql first, Postgres next).

Readme

@intentface/latch-drizzle

The persistence tier for Latch — a StorageAdapter and SecretStore implemented on Drizzle (libsql/SQLite first-class, Postgres alongside).

What it does

  • createSqliteAdapter / (pg variant) — the StorageAdapter the runtime persists through: chats, messages (the AppMessage source of truth), runs (status, leases, usage, cost incl. cached-token split), usage ledger, and schedules. Owner-keyed for org/user isolation (the owner fn derives the key from your Principal).
  • createSqliteSecretStore — the encrypted record store behind the core Vault (it never sees plaintext; the Vault wraps/unwraps).
  • migrate(client) — creates the latch_* tables (CREATE TABLE IF NOT EXISTS) plus idempotent ALTERs for columns added later (timezone, cached-token counts, …). Safe to run at startup; no migration tooling required.

Tables: latch_chats, latch_messages, latch_runs, latch_usage, latch_secrets, latch_schedules.

Usage

import { createClient } from "@libsql/client";
import { createSqliteAdapter, createSqliteSecretStore, migrate } from "@intentface/latch-drizzle";

const client = createClient({ url: DATABASE_URL, authToken: TURSO_AUTH_TOKEN });
await migrate(client);

const owner = (p: Principal) => (p.userId ? [p.orgId, p.userId] : [p.orgId]);
const storage = createSqliteAdapter<Principal>(client, { owner });

Owner-key contract. owner must be a pure projection of the stable part of your principal — durable ids from your database, never per-session state (an "active org" that can be null on some requests will silently split one user's data across two keys). The key is derived once, at root-resource creation; child rows inherit it. Never re-derive it from a live principal in a different request context (OAuth callbacks, webhooks, cron) — pin identity into the flow/run and rebuild it via reconstructPrincipal instead.

Where it fits

The T1 (persistence) tier under @intentface/latch-core. Swap it for another StorageAdapter implementation behind the same contract.