Easy to use wrapper and Drizzle ORM driver for DuckDB WASM
Web browser based Playground, try it!
Note
This project is part of (and also associate to) the Project AIRI, we aim to build a LLM-driven VTuber like Neuro-sama (subscribe if you didn't!) if you are interested in, please do give it a try on live demo.
We use both DuckDB WASM and PGLite for the backbone implementation for memory layer as embedded databases that capable of doing vector search to power up bionic memory systems for AI VTuber and cyber livings. We shared a lot in our DevLogs in DevLog @ 2025.04.06, please read it if you are interested in!
Who are we?
We are a group of currently non-funded talented people made up with computer scientists, experts in multi-modal fields, designers, product managers, and popular open source contributors who loves the goal of where we are heading now.
Note
Usage notes (as of Apr 12, 2025)
While using @proj-airi/duckdb-wasm
directly or indirectly with Vite, you may encounter the following error:
Cannot read file: .../node_modules/.pnpm/@duckdb+duckdb-wasm@1.29.1-dev68.0/node_modules/@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js?url
node_modules/.pnpm/@proj-airi+duckdb-wasm@0.4.21/node_modules/@proj-airi/duckdb-wasm/dist/bundles/import-url-browser.mjs:3:26:
3 β import mvpMainWorker from '@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js?url';
β΅ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is due to an open issue with Vite, as a workaround, you can try excluding @proj-airi/duckdb-wasm
in optimizeDeps
in your
vite.config.ts
:
export default defineConfig({
// ...
optimizeDeps: {
exclude: ['@proj-airi/duckdb-wasm']
}
})
See also: vitejs/vite#10838
ni @proj-airi/drizzle-duckdb-wasm # from @antfu/ni, can be installed via `npm i -g @antfu/ni`
pnpm i @proj-airi/drizzle-duckdb-wasm
yarn i @proj-airi/drizzle-duckdb-wasm
npm i @proj-airi/drizzle-duckdb-wasm
import { drizzle } from '@proj-airi/drizzle-duckdb-wasm'
const db = drizzle('duckdb-wasm://?bundles=import-url', { schema })
const results = await db.execute('SELECT count(*)::INTEGER as v FROM generate_series(0, 100) t(v)')
console.log(results) // Output [{ v: 101 }]
// Remember to close / dispose the resources.
await db.$client.close()
@proj-airi/drizzle-duckdb-wasm
: Drizzle ORM driver for DuckDB WASM@proj-airi/duckdb-wasm
: Easy to use wrapper for@duckdb/duckdb-wasm
pnpm i
Start the Drizzle DuckDB WASM playground locally:
pnpm -F @proj-airi/drizzle-duckdb-wasm play:dev