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

surgedb-wasm

v1.0.0-alpha.5

Published

High-performance vector database for the browser

Readme

SurgeDB WASM

npm version License Size

SurgeDB WASM brings high-performance, persistent vector search directly to the browser.

It is a lightweight WebAssembly binding for the SurgeDB engine, optimized for edge devices and client-side applications. Run semantic search, recommendation systems, and RAG pipelines entirely offline without sending user data to a server.


Key Features

  • 🔒 Privacy First: All data stays on the client. No API calls, no data leaks.
  • Sub-millisecond Search: Powered by SIMD-accelerated HNSW indices (Rust).
  • 📦 Tiny Footprint: ~100KB gzipped (WASM + JS).
  • 💾 Memory Efficient: Built-in SQ8 quantization reduces memory usage by 4x.
  • 🛠️ TypeScript: Fully typed API for seamless development.

Installation

npm install surgedb-wasm

Quick Start

SurgeDB is designed to work seamlessly with modern bundlers (Vite, Webpack, etc.).

import init, { SurgeDB } from 'surgedb-wasm';

async function main() {
    // 1. Initialize the WASM module
    await init();
    
    // 2. Create the database (384 dimensions for MiniLM)
    const db = new SurgeDB(384);
    
    // 3. Add documents
    db.insert("doc_1", new Float32Array([0.1, 0.2, 0.3, ...]), { 
        title: "Client-side AI", 
        category: "Web" 
    });

    db.insert("doc_2", new Float32Array([0.4, 0.5, 0.6, ...]), { 
        title: "Rust in Browser", 
        category: "Web" 
    });
    
    // 4. Search
    const query = new Float32Array([0.1, 0.2, 0.3, ...]);
    const results = db.search(query, 5); // Start with top 5
    
    console.log(results);
    // Output: [{ id: "doc_1", score: 1.0, metadata: {...} }, ...]

    // 5. Clean up memory when component unmounts
    db.free();
}

main();

Advanced Usage

Quantization (Save 4x Memory)

For larger datasets (10k+ vectors), use SurgeDBQuantized to enable SQ8 compression. This slightly reduces precision but drastically lowers memory usage.

import init, { SurgeDBQuantized } from 'surgedb-wasm';

await init();
const db = new SurgeDBQuantized(384);

// Usage is identical to standard SurgeDB
db.insert("id", vector, metadata);

React Example

import { useEffect, useState } from 'react';
import init, { SurgeDB } from 'surgedb-wasm';

export function VectorSearch() {
  const [db, setDb] = useState<SurgeDB | null>(null);

  useEffect(() => {
    init().then(() => {
      const database = new SurgeDB(384);
      setDb(database);
    });

    return () => db?.free();
  }, []);

  const handleSearch = (queryVec: Float32Array) => {
    if (!db) return;
    const results = db.search(queryVec, 10);
    console.log(results);
  };

  return <div>Search Component</div>;
}

Performance Benchmark

Benchmarks run on an M2 MacBook Air (Chrome):

| Operation | Metric | | :--- | :--- | | Search Latency | ~0.5ms (1k vectors) | | Insert Speed | ~50ms (1k vectors) | | Memory (Quantized) | ~400KB per 1k vectors | | Memory (Standard) | ~1.5MB per 1k vectors |


Development & Building

If you are contributing to the project or building from source:

# Install wasm-pack
cargo install wasm-pack

# Build for npm (generates pkg/ directory)
wasm-pack build --target web --release