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

applesauce-indexeddb

v0.1.0

Published

IndexedDB event database for Applesauce in browsers and workers

Readme

applesauce-indexeddb

Framework-independent IAsyncEventDatabase for browsers and workers with IndexedDB. Uses nostr-idb 5.1's schema, tag encoding and low-level author/kind/tag query helpers, plus idb for typed transactions. It has no dependency on browserdb or Qwik.

import { openIndexedDBEventDatabase } from "applesauce-indexeddb";
const database = await openIndexedDBEventDatabase({ name: "my-events-v1" });
// await database.add(aVerifiedNostrEvent);
const timeline = await database.getTimeline({ kinds: [1], limit: 50 });
await database.close();

The adapter always requires IndexedDB. Denied/absent storage rejects; it never creates a memory cache. Fallback belongs in an application selector such as mostard-qwik-browserdb. persistence, if supplied, must be "required". Options include injected factory, signal, timeoutMs and an advisory probe. Applications close the returned database. Abort, timeout and blocked upgrades reject and release late connections. Version changes close the connection; subsequent operations fail until the application explicitly initializes a new lifetime.

The high-level nostr-idb class is deliberately not instantiated: its cached map, queued writes, pruning and address-key replacement would change Applesauce's database contract. This adapter stores plain signed fields under event-id primary keys so replaceable history remains queryable. No runtime symbols are persisted. It awaits transaction completion (tx.done), not merely a request or commit() call. There is no automatic pruning.

Schema version 3 contains nostr-idb events and used stores and its standard indexes. used is reserved for compatibility and is not used for a RAM/pruning layer. Upgrading an earlier applesauce generic records cache copies its plain events into the new store in the upgrade transaction; old records remain untouched. Existing nostr-idb databases with address-keyed replaceables are not interchangeable: use a distinct application database name.

Queries narrow with one index and then apply Applesauce's complete Nostr matcher. Filter branches union after each branch's limit, sort newest first with ascending id ties, preserve NIP-91 tag semantics, and match empty ids/authors/kinds/OR-tag groups to no events. Full-text search and invalid limits reject with Validation. Replaceable history remains available until explicit removal.

This is a cache adapter, not an event verifier. Verify network events through Applesauce's EventStore before inserting. removeByFilters() selects matching ids, then deletes those ids in one write transaction; concurrent new arrivals after selection are not included.

Run package tests with pnpm exec vitest run --project applesauce-indexeddb from the Applesauce workspace, and build with pnpm --filter applesauce-indexeddb build.