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

@proj-airi/drizzle-duckdb-wasm

v0.5.0

Published

🦆 Drizzle ORM driver for @duckdb/duckdb-wasm that works on both browser and Node.js environments

Readme

🦆 Drizzle ORM driver for @duckdb/duckdb-wasm

This package provides a Drizzle ORM driver for the DuckDB WASM implementation.

Playground

Installation

Pick the package manager of your choice:

ni @proj-airi/drizzle-duckdb-wasm -D # from @antfu/ni, can be installed via `npm i -g @antfu/ni`
pnpm i @proj-airi/drizzle-duckdb-wasm -D
yarn i @proj-airi/drizzle-duckdb-wasm -D
npm i @proj-airi/drizzle-duckdb-wasm -D

Usage

import { drizzle } from '@proj-airi/drizzle-duckdb-wasm'

const db = drizzle('duckdb-wasm://?bundles=import-url', { schema })

Browser

Vue.js

// ./db/schema.ts
import { sql } from 'drizzle-orm'
import { pgTable, uuid } from 'drizzle-orm/pg-core'

export const users = pgTable('users', () => ({
  id: uuid().primaryKey().unique().default(sql`gen_random_uuid()`),
}))
drizzle-kit generate
<!-- ./src/App.vue -->
<script setup lang="ts">
  import type { DuckDBWasmDrizzleDatabase } from '@proj-airi/drizzle-duckdb-wasm'

  import { drizzle } from '@proj-airi/drizzle-duckdb-wasm'
  import { getImportUrlBundles } from '@proj-airi/drizzle-duckdb-wasm/bundles/import-url-browser'
  import { useDebounceFn } from '@vueuse/core'
  import { serialize } from 'superjson'
  import { onMounted, onUnmounted, ref, watch } from 'vue'

  import * as schema from './db/schema'
  import { users } from './db/schema'
  import migration1 from './drizzle/0000_cute_kulan_gath.sql?raw'

  const results = ref<any[]>([])

  onMounted(async () => {
    // db.value = drizzle('duckdb-wasm://?bundles=import-url', { schema })
    // db.value = drizzle({ connection: { bundles: getImportUrlBundles() } }, { schema })

    await db.value?.execute(migration1)
    results.value = await db.value?.execute('SELECT count(*)::INTEGER as v FROM generate_series(0, 100) t(v)')
    console.log(results.value) // Output [{ v: 101 }]

    await db.value.insert(users).values({ id: '00000000-0000-0000-0000-000000000000' })
    const foundUsers = await db.value.select().from(users)
    console.log(foundUsers) // Output [{ id: '00000000-0000-0000-0000-000000000000' }]
  })

  onUnmounted(async () => {
    if (db.value) {
      const client = await db.value.$client
      await client.close()
    }
  })
</script>

Node.js

You will need to install web-worker too.

ni web-worker # from @antfu/ni, can be installed via `npm i -g @antfu/ni`
pnpm i web-worker
yarn i web-worker
npm i web-worker
// ./db/schema.ts
import { sql } from 'drizzle-orm'
import { pgTable, uuid } from 'drizzle-orm/pg-core'

export const users = pgTable('users', () => ({
  id: uuid().primaryKey().unique().default(sql`gen_random_uuid()`),
}))
drizzle-kit generate
// ./src/index.ts
import { read } from 'node:fs/promises'

import { drizzle } from '@proj-airi/drizzle-duckdb-wasm'
import { getBundles } from '@proj-airi/drizzle-duckdb-wasm/bundles/default-node'

import * as schema from './db/schema'
import { users } from './db/schema'

async function main() {
  const db = drizzle({ connection: { bundles: getBundles() } }, { schema })

  // Run migration scripts
  const migration1 = await read('./drizzle/0000_cute_kulan_gath.sql', 'utf-8')
  await db.execute(migration1)

  const res = await db.execute('SELECT count(*)::INTEGER as v FROM generate_series(0, 100) t(v)')
  console.log(res) // Output [{ v: 101 }]

  await db.insert(users).values({ id: '00000000-0000-0000-0000-000000000000' })
  const foundUsers = await db.select().from(users)
  console.log(foundUsers) // Output [{ id: '00000000-0000-0000-0000-000000000000' }]

  // Remember to close it when you are done
  const client = await db.$client
  await client.close()
}

Footnotes

Check out the package we made for easier call to @duckdb/duckdb-wasm as well!