README.md
May 18, 2026 · View on GitHub
Haybarn-Wasm
Haybarn for WebAssembly — Haybarn, powered by DuckDB.
Haybarn is a derived distribution of DuckDB, the in-process SQL OLAP database, published by Query Farm LLC. Haybarn-Wasm is the WebAssembly distribution of Haybarn — the same engine, compiled for browsers and Node.js, with the Haybarn extension repository wired in by default.
This is a hard fork of duckdb/duckdb-wasm,
re-pointed at the Haybarn engine
submodule so the resulting wasm binary loads extensions from
haybarn-extensions.query.farm (Haybarn's R2-backed extension channel) rather
than upstream's extensions.duckdb.org.
Install
npm install @haybarn/haybarn-wasm
The package exposes the same API surface as @duckdb/duckdb-wasm. Existing
duckdb-wasm consumer code can be ported by rewriting the import:
// before
import * as duckdb from '@duckdb/duckdb-wasm';
// after
import * as duckdb from '@haybarn/haybarn-wasm';
See HAYBARN.md for the relationship to upstream duckdb-wasm, the patch stack, and how to rebase onto a newer upstream release.
Haybarn engine version
This branch is built on top of the Haybarn engine haybarn-v1.5.2-rc13 tag,
which corresponds to DuckDB v1.5.2 plus the Haybarn patch stack (trademark
strings, extension repository URLs, trust root).
Wasm variants
Haybarn-Wasm ships three wasm binaries — same three variants as upstream:
| Variant | What you get | Hosting requirement |
|---|---|---|
mvp | Plain WebAssembly, broadest compatibility | None |
eh | Native WebAssembly Exception Handling — ~20–40% faster on modern browsers | None |
coi | EH + threads + SIMD via SharedArrayBuffer | Requires Cross-Origin Isolation HTTP headers (COOP=same-origin, COEP=require-corp) |
The bundle selector (selectBundle() in @haybarn/haybarn-wasm) picks the
best variant your browser can run, the same way upstream does.
Loading extensions
Extensions are fetched lazily from the Haybarn extension channel:
INSTALL spatial; -- → haybarn-extensions.query.farm/core/v1.5.2/wasm_eh/spatial.duckdb_extension.wasm
LOAD spatial;
Community extensions are addressed via the community shorthand:
INSTALL h3 FROM community;
LOAD h3;
For the full extension catalog and per-platform availability, see haybarn-status.query.farm.
Build from source
git clone https://github.com/Query-farm-haybarn/haybarn-wasm.git
cd haybarn-wasm
git submodule update --init --recursive
make apply_patches
make serve
Repository structure
| Subproject | Description | Language |
|---|---|---|
lib | Wasm library | C++ |
@haybarn/haybarn-wasm | TypeScript API (published) | TypeScript |
@haybarn/haybarn-wasm-shell | SQL shell | Rust |
@haybarn/haybarn-wasm-app | Demo app | TypeScript |
@haybarn/react-haybarn | React hooks | TypeScript |
Only @haybarn/haybarn-wasm is published to npm; the other packages are
private and used internally for testing + demos. Directory names match the
upstream duckdb-wasm tree so rebases stay small.
License
MIT, same as upstream. See LICENSE for the Stichting DuckDB Foundation copyright on the original work, and NOTICE for the Haybarn-specific attribution.
DuckDB is a trademark of the DuckDB Foundation. Haybarn is an independent derived distribution published by Query Farm LLC.