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

sqlite-vec-wasm

v0.1.0

Published

Precompiled SQLite 3.50.4 + sqlite-vec v0.1.6 for WebAssembly with worker and OPFS support.

Readme

sqlite-vec-wasm

SQLite 3.50.4 with sqlite-vec v0.1.6 compiled to WebAssembly using the official SQLite WASM build system.

Features

  • Full SQLite 3.50.4 running in the browser
  • Vector similarity search with sqlite-vec v0.1.6 auto-initialized
  • Official SQLite WASM API with OO1 wrapper
  • Worker thread support
  • OPFS (Origin-Private FileSystem) support
  • ESM and bundler-friendly builds
  • FTS5, R-Tree, JSON1, and more extensions
  • Pure WASM - no server required

Build Output

Pre-built files in dist/ (official SQLite WASM build):

  • sqlite3.js (766 KB) - Full JavaScript API with all features
  • sqlite3.wasm (1.9 MB) - Compiled binary with SQLite + sqlite-vec
  • sqlite3.mjs - ES6 module version
  • sqlite3-bundler-friendly.mjs - For bundlers (webpack, vite, etc.)
  • sqlite3-worker1*.js - Worker thread support files
  • sqlite3-opfs-async-proxy.js - OPFS support

Quick Start

  1. Serve the files with a local web server with COOP/COEP headers:
# Using the included Node.js server (recommended)
node server.js

# Or use the official SQLite build's server:
cd sqlite-src/ext/wasm
make httpd  # Uses althttpd with -enable-sab flag
  1. Open test.html in your browser to see it working:
http://localhost:8000/test.html

Notes:

  • COOP/COEP headers are required for SharedArrayBuffer support
  • OPFS (Origin-Private FileSystem) VFS requires running in a Worker thread
  • Standard python3 -m http.server doesn't send the required headers

Building from Source

This project uses the official SQLite WASM build system with sqlite-vec integrated.

Prerequisites

  • Emscripten SDK
  • GNU Make
  • Standard build tools (gcc, etc.)

Build Steps

The build process:

  1. Setup Emscripten (if not already installed):
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
  1. Get SQLite source with WASM build system:
# Download and extract SQLite source
curl -O https://www.sqlite.org/2025/sqlite-src-3504000.zip
unzip sqlite-src-3504000.zip
mv sqlite-src-3504000 sqlite-src
  1. Clone sqlite-vec into SQLite extensions:
git clone https://github.com/asg017/sqlite-vec.git sqlite-src/ext/sqlite-vec
cd sqlite-src/ext/sqlite-vec
git checkout v0.1.6
  1. Generate sqlite-vec.h:
cd sqlite-src/ext/sqlite-vec
VERSION='0.1.6'
sed -e "s/\${VERSION}/$VERSION/g" \
    -e "s/\${VERSION_MAJOR}/0/g" \
    -e "s/\${VERSION_MINOR}/1/g" \
    -e "s/\${VERSION_PATCH}/6/g" \
    -e 's/SQLITE_VEC_LOADABLE_EXTENSION 1/SQLITE_VEC_LOADABLE_EXTENSION 0/' \
    sqlite-vec.h.tmpl > sqlite-vec.h
  1. Configure SQLite build:
cd sqlite-src
./configure --with-emsdk=/path/to/emsdk
  1. Integrate sqlite-vec by modifying ext/wasm/GNUmakefile:

    • Add sqlite-vec.c to compilation
    • Add include path for sqlite-vec
    • Create auto-init file
  2. Build:

cd ext/wasm
make

Output will be in sqlite-src/ext/wasm/jswasm/

Usage Example

Using the Official OO1 API (Recommended)

sqlite3InitModule().then(function(sqlite3){
    // Open database
    const db = new sqlite3.oo1.DB();

    // sqlite-vec is auto-initialized! No manual init required.

    // Create vector table
    db.exec('CREATE VIRTUAL TABLE vec_items USING vec0(embedding float[384]);');

    // Insert vectors
    db.exec("INSERT INTO vec_items(rowid, embedding) VALUES (1, '[0.1, 0.2, 0.3, ...]');");

    // Query vectors
    const results = db.exec({
        sql: 'SELECT rowid, embedding FROM vec_items',
        rowMode: 'object',
        returnValue: 'resultRows'
    });

    // Search for similar vectors
    const similar = db.exec({
        sql: `SELECT rowid, distance
              FROM vec_items
              WHERE embedding MATCH '[0.15, 0.25, 0.35, ...]'
              ORDER BY distance LIMIT 5`,
        returnValue: 'resultRows'
    });

    // Check sqlite-vec version
    const version = db.exec({
        sql: 'SELECT vec_version()',
        returnValue: 'resultRows'
    });

    db.close();
});

Using in a Worker

importScripts('dist/sqlite3.js');
sqlite3InitModule().then(function(sqlite3){
    const db = new sqlite3.oo1.DB();
    // ... use the same API as above
});

Using as ES6 Module

import sqlite3InitModule from './dist/sqlite3.mjs';
const sqlite3 = await sqlite3InitModule();
const db = new sqlite3.oo1.DB();
// ... rest of your code

Note: sqlite-vec is automatically initialized when you open a database - no need to call sqlite3_vec_init() manually!

What's Compiled In

SQLite Features:

  • FTS5 (full-text search)
  • R-Tree (spatial indexing)
  • JSON1 (JSON functions)
  • Session extension
  • DBSTAT, DBPAGE virtual tables
  • Math functions
  • And more - see official SQLite WASM docs

sqlite-vec Features:

  • vec0 virtual table for vector storage
  • Float32, Float64, Int8 vector types
  • Multiple distance metrics
  • KNN search
  • Auto-initialized on database open

Build Configuration:

  • Official SQLite WASM build system
  • Full OO1 API wrapper
  • Worker thread support
  • OPFS (Origin-Private FileSystem)
  • Memory growth enabled
  • Web + Worker environments

Project Structure

.
├── dist/                         # Built WASM files from official build
│   ├── sqlite3.js                # Main vanilla JS build
│   ├── sqlite3.wasm              # WASM binary
│   ├── sqlite3.mjs               # ES6 module
│   ├── sqlite3-bundler-friendly.mjs
│   ├── sqlite3-worker1*.js       # Worker support
│   └── sqlite3-opfs-async-proxy.js
├── sqlite-src/                   # Full SQLite source tree
│   ├── ext/
│   │   ├── wasm/                 # Official WASM build system
│   │   │   ├── GNUmakefile       # Modified to include sqlite-vec
│   │   │   └── sqlite3_wasm_extra_init.c  # Auto-init sqlite-vec
│   │   └── sqlite-vec/           # sqlite-vec extension
│   └── ...
├── test.html                     # Demo using OO1 API
└── README.md

Note: Source directories (emsdk/, sqlite-src/) are excluded from git.

License

  • SQLite: Public Domain
  • sqlite-vec: Apache 2.0 / MIT dual license
  • This build script: Public Domain

Credits