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

@quereus/store-indexeddb

v0.2.1

Published

IndexedDB KVStore implementation for Quereus - browser persistent storage

Readme

@quereus/store-indexeddb

IndexedDB storage backend for @quereus/plugin-store. Provides persistent storage for Quereus in browser environments.

Features

  • Browser-native: Uses IndexedDB for reliable persistent storage
  • Cross-tab sync: BroadcastChannel-based synchronization across browser tabs
  • Two modes: Per-table databases or unified single database
  • Async iteration: Efficient range queries with cursor-based iteration

Installation

npm install @quereus/store-indexeddb @quereus/plugin-store

Quick Start

With registerPlugin (Recommended)

import { Database, registerPlugin } from '@quereus/quereus';
import storePlugin from '@quereus/plugin-store';

const db = new Database();
await registerPlugin(db, storePlugin);  // Auto-detects browser, uses IndexedDB

await db.exec(`CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT) USING store`);

Direct Usage

import { Database } from '@quereus/quereus';
import { IndexedDBModule } from '@quereus/store-indexeddb';

const db = new Database();
const module = new IndexedDBModule();
db.registerVtabModule('store', module);

await db.exec(`
  CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)
  USING store(database='myapp')
`);

Unified Mode (Recommended for Multi-Table)

For applications with multiple tables, use UnifiedIndexedDBModule which stores all tables in a single IndexedDB database:

import { UnifiedIndexedDBModule } from '@quereus/store-indexeddb';

const module = new UnifiedIndexedDBModule({ databaseName: 'myapp' });
db.registerVtabModule('store', module);

// All tables share one IDB database
await db.exec(`CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT) USING store`);
await db.exec(`CREATE TABLE orders (id INTEGER PRIMARY KEY, total REAL) USING store`);

// Atomic cross-table writes
const batch = module.createMultiStoreBatch();
batch.putToStore('main.users', userKey, userData);
batch.putToStore('main.orders', orderKey, orderData);
await batch.write();  // Single transaction

API

IndexedDBStore

Low-level KVStore implementation:

import { IndexedDBStore } from '@quereus/store-indexeddb';

const store = await IndexedDBStore.open({
  databaseName: 'myapp',
  storeName: 'users'
});

await store.put(key, value);
const data = await store.get(key);
await store.delete(key);

// Range iteration
for await (const { key, value } of store.iterate({ gte: startKey, lt: endKey })) {
  console.log(key, value);
}

await store.close();

IndexedDBProvider

Factory for managing multiple stores:

import { createIndexedDBProvider } from '@quereus/store-indexeddb';

const provider = createIndexedDBProvider({ prefix: 'myapp' });

const userStore = await provider.getStore('main', 'users');
const catalogStore = await provider.getCatalogStore();

await provider.closeAll();

UnifiedIndexedDBManager

Single-database manager for all tables:

import { UnifiedIndexedDBManager } from '@quereus/store-indexeddb';

const manager = new UnifiedIndexedDBManager({ databaseName: 'myapp' });
await manager.initialize();

const userStore = await manager.getStore('main.users');
const orderStore = await manager.getStore('main.orders');

// List all stores
const stores = manager.getStoreNames();  // ['main.users', 'main.orders']

await manager.close();

CrossTabSync

Synchronize changes across browser tabs:

import { CrossTabSync } from '@quereus/store-indexeddb';

const sync = new CrossTabSync('myapp');

sync.onDataChange((event) => {
  console.log('Tab change:', event.storeName, event.type, event.key);
  refreshUI();
});

// Broadcast a change to other tabs
sync.notifyDataChange('main.users', 'put', key);

sync.close();

Configuration

IndexedDBStore Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | databaseName | string | required | IndexedDB database name | | storeName | string | required | Object store name |

UnifiedIndexedDBManager Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | databaseName | string | 'quereus' | Single IDB database name | | crossTabSync | boolean | true | Enable cross-tab synchronization |

Related Packages

License

MIT