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

dazzle-react

v1.0.0-beta.7.3

Published

Dazzle SDK for React (DOM) — embedded in-process database with HNSW vector search inside the browser, with persistence backed by the Origin Private File System (OPFS). Ships the same dazzle.wasm the Flutter Web / RN Web targets use, plus React hooks (useD

Readme

dazzle-react

React bindings for the Dazzle WebAssembly runtime. HNSW vector search + hash KV running 100% in the browser, persisted to OPFS, exposed as React hooks.

Same dazzle.wasm as the dazzle_flutter and dazzle-react-native packages — zero behaviour drift across all three web targets.

What's new in 1.0.0-beta.7.x

Eleven additive features landed across beta.7 → beta.7.2 — every one of them additive, no breaking ABI.

  • DazzleServer.health() — typed DazzleHealth snapshot (uptime, memory, clients, keys, RDB / BGSAVE state, version).
  • DazzleServer.healthFlow() / healthStream() — periodic emitter (Kotlin Flow / Swift AsyncStream).
  • DazzleServer.bgSave() / bgRewriteAof() — typed wrappers with a sealed BgCheckpointResult (Started / AlreadyInProgress / NotRunning / Failed).
  • DazzleServer.stopAsync() + commandWithTimeout() — suspend / async variants that respect coroutine cancellation and surface DazzleException.Timeout cleanly.
  • VectorIndex.saveGraph() / loadGraph() — HNSW graph persistence MVP, fp32 cosine only this release.
  • RecoveryMode.QUARANTINE_AND_COLD_START — opt-in: rename corrupt RDB / AOF artifacts to <name>.corrupt-<unix-ms> and boot cold instead of crash-looping.
  • ExecutionPolicy.lowEnd / .midRange / .flagship — hand-tuned device-class presets.
  • Granular stopReason on LlamaCppClient (Kotlin): distinguishes "eos" / "max_tokens" / "cancel" / "error" instead of conflating them.
  • Delta.Usage / .usage(TokenUsage) — per-turn LLM telemetry (prompt / new tokens, prefill / decode latency).
  • DazzleErrorCode frozen 1.0 ABI — 19 codes (0..18).
  • IndexCapacityExceeded, PrefillAborted, IndexNotFound, Timeout typed exceptions across every SDK.

See CHANGELOG.md for the full prose and code snippets per platform.

Install

npm install dazzle-react

Setup

The package ships dazzle.wasm (~236 KB) + dazzle.js (~68 KB) under web/native/. Configure your bundler (Vite, Webpack, esbuild, …) to copy them as static assets, then load them as an ES module before your React app boots:

<!-- index.html -->
<script type="module">
  import dz from "/path/to/dazzle.js";
  globalThis.dazzleModule = dz;
</script>

Vite copy snippet

// vite.config.ts
import { viteStaticCopy } from 'vite-plugin-static-copy';

export default {
  plugins: [
    viteStaticCopy({
      targets: [{ src: 'node_modules/dazzle-react/web/native/*', dest: 'dazzle' }],
    }),
  ],
};

then point the loader script at /dazzle/dazzle.js.

Quick start

import {
  useDazzleInit,
  useDazzleHash,
  useVectorIndex,
  useVectorSearch,
} from 'dazzle-react';

export function App() {
  const { ready, error } = useDazzleInit();
  if (error)  return <p>Failed to load Dazzle: {error.message}</p>;
  if (!ready) return <p>Loading…</p>;

  return <Catalog />;
}

function Catalog() {
  const hash  = useDazzleHash('chat:1');
  const index = useVectorIndex('catalog');

  const handleSeed = () => {
    index.create({ dim: 1536 });
    index.add('product-1', new Float32Array(/* 1536 floats */));
    hash.set('lastSeededAt', Date.now().toString());
  };

  const { hits } = useVectorSearch('catalog', queryEmbedding, { topK: 5 });
  return (
    <ul>
      {hits.map(h => <li key={h.id}>{h.id} (d={h.distance.toFixed(3)})</li>)}
    </ul>
  );
}

Imperative API

If you don't want hooks, the underlying class API works just fine:

import { DazzleWeb } from 'dazzle-react';

await DazzleWeb.initialize();
DazzleWeb.hash('chat:1').set('role', 'user');
const hits = DazzleWeb.vectorIndex('catalog').search(query, { topK: 5 });
await DazzleWeb.persist();

Hooks

| Hook | Returns | Use | |---|---|---| | useDazzleInit({ opfsFileName? }) | { ready, error } | Boot the runtime once near the root | | useDazzleHash(key) | DazzleWebHash | Stable handle to a hash | | useVectorIndex(name) | DazzleWebVectorIndex | Stable handle to a vector index | | useVectorSearch(name, query, opts?) | { hits, refresh } | Re-runs search when query changes | | useAutoPersist() | void | Snapshot to OPFS on unmount |

Scope (1.0.0-beta.6)

  • ✅ Hash KV (HSET/HGET/HGETALL/HDEL)
  • ✅ Vector index (HNSW): create / add / addBatch / search / drop
  • ✅ Snapshot persistence to OPFS

Out of MVP for web (use the iOS/Android/Desktop targets):

  • Lists / Sets / SortedSets / Streams standalone primitives
  • On-device LLM clients (LlamaCpp, LiteRT-LM, FoundationModels)

React Native?

If you're on React Native (with or without web target), use dazzle-react-native instead — it ships native bindings for iOS / Android plus the same WASM bridge for RN Web.

Changelog

See CHANGELOG.md for per-version notes, or the repo CHANGELOG for cross-stack release notes.

License

Apache 2.0.