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

novadb-react

v1.0.0

Published

NovaDB React SDK – hooks and provider

Readme

novadb-react

React hooks and provider for NovaDB — the high-performance embeddable Rust database.

npm

Install

npm install novadb-react novadb-rs

Setup — wrap your app with <NovaDBProvider>

// main.tsx / index.tsx
import React from 'react'
import ReactDOM from 'react-dom/client'
import { NovaDBProvider } from 'novadb-react'
import { NovaDb } from 'novadb-rs'
import App from './App'

ReactDOM.createRoot(document.getElementById('root')!).render(
  <NovaDBProvider db={() => NovaDb.inMemory()}>
    <App />
  </NovaDBProvider>
)

useQuery — read data reactively

import { useQuery, useNovaDB } from 'novadb-react'

function UserList() {
  const db = useNovaDB()

  const { data, loading, error, refetch } = useQuery(
    () => db.collection('users').find({ active: true }),
    { deps: [] }   // re-run when deps change (like useEffect)
  )

  if (loading) return <p>Loading…</p>
  if (error)   return <p>Error: {error.message}</p>

  return (
    <>
      <button onClick={refetch}>Refresh</button>
      <ul>
        {data?.map(u => <li key={u._id as string}>{u.name as string}</li>)}
      </ul>
    </>
  )
}

useMutation — write data

import { useMutation, useNovaDB } from 'novadb-react'

function AddUser() {
  const db = useNovaDB()

  const { mutate, loading, error } = useMutation(
    (name: string) =>
      db.collection('users').insert({ name, active: true, createdAt: Date.now() })
  )

  async function handleAdd() {
    await mutate('Alice')
    // data is inserted — trigger a refetch in useQuery via shared state or context
  }

  return (
    <button onClick={handleAdd} disabled={loading}>
      {loading ? 'Saving…' : 'Add User'}
    </button>
  )
}

useSubscription — poll for live updates

import { useSubscription, useNovaDB } from 'novadb-react'

function LiveCount() {
  const db = useNovaDB()

  const { data } = useSubscription(
    () => db.collection('messages').count({}),
    { interval: 2000 }   // poll every 2 seconds
  )

  return <p>Messages: {data ?? '…'}</p>
}

Full CRUD example

import { useState } from 'react'
import { useQuery, useMutation, useNovaDB } from 'novadb-react'

interface User { _id: string; name: string; age: number }

function Users() {
  const db   = useNovaDB()
  const col  = db.collection<User>('users')
  const [name, setName] = useState('')

  const { data: users = [], loading, refetch } = useQuery(
    () => col.find({}),
    { deps: [] }
  )

  const { mutate: addUser } = useMutation(async (name: string) => {
    await col.insert({ name, age: 0 })
    refetch()
  })

  const { mutate: removeUser } = useMutation(async (id: string) => {
    await col.deleteOne({ _id: id })
    refetch()
  })

  return (
    <div>
      <input value={name} onChange={e => setName(e.target.value)} placeholder="Name" />
      <button onClick={() => addUser(name)}>Add</button>

      {loading ? <p>Loading…</p> : (
        <ul>
          {users.map(u => (
            <li key={u._id}>
              {u.name}
              <button onClick={() => removeUser(u._id)}>Delete</button>
            </li>
          ))}
        </ul>
      )}
    </div>
  )
}

API

| Hook / Component | Description | |---|---| | <NovaDBProvider db={...}> | Provides the DB instance to the component tree | | useNovaDB() | Returns the NovaDB instance | | useNovaDBContext() | Returns { db, ready, error } | | useQuery(fn, opts) | Runs a query, returns { data, loading, error, refetch } | | useMutation(fn) | Returns { mutate, loading, error } | | useSubscription(fn, opts) | Polls a query at interval ms |

License

MIT