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

@hanzo/base

v0.2.7

Published

Hanzo Base SDK - Reactive queries, CRDT, realtime, and Base-compatible client

Readme

@hanzo/base

npm

The JavaScript/TypeScript client for Hanzo Base, the reactive backend. Auth is Hanzo IAM-native: the client holds the IAM-issued JWT and validates it locally.

Zero runtime dependencies. Records/collections CRUD, realtime (SSE), files, reactive queries with optimistic writes, and CRDT primitives — with optional React bindings.

There is a companion Dart client, hanzo, that mirrors this shape.

Install

npm install @hanzo/base
import { BaseClient } from '@hanzo/base'

const base = new BaseClient('https://base.hanzo.ai')

Auth (Hanzo IAM)

await base.collection('users').authWithPassword('[email protected]', 'secret')

base.authStore.isValid   // JWT present and unexpired
base.authStore.token     // the IAM JWT
base.authStore.record    // the authenticated record

base.signOut()

Persist the session in the browser:

import { BaseClient } from '@hanzo/base'
import { LocalAuthStore } from '@hanzo/base/compat'

const base = new BaseClient({
  url: 'https://base.hanzo.ai',
  authStore: new LocalAuthStore(),
})

Records / collections

const page = await base.collection('posts').getList(1, 20, {
  filter: 'published = true',
  sort: '-created',
})

const one = await base.collection('posts').getOne('RECORD_ID')
const made = await base.collection('posts').create({ title: 'hi' })
await base.collection('posts').update('RECORD_ID', { title: 'yo' })
await base.collection('posts').delete('RECORD_ID')

Realtime (SSE)

const off = base.collection('posts').subscribe('*', (e) => {
  console.log(e.action, e.record) // 'create' | 'update' | 'delete'
})
off()

Files

const url = base.files.getURL(record, 'photo.png', { thumb: '100x100' })

Reactive queries + CRDT

@hanzo/base ships a reactive QueryStore with optimistic updates and server reconciliation, plus CRDT primitives (@hanzo/base/crdt) for collaborative state. React bindings live at @hanzo/base/react.

import { QueryStore } from '@hanzo/base'
import { CRDTText } from '@hanzo/base/crdt'

Develop

npm install
npm run build
npm test

License

MIT © Hanzo AI, Inc. See LICENSE.

@hanzo/base/rest — the table wire

A sibling of the collection client, not a replacement. That one speaks Base's own /v1 surface: collections, records, realtime, CRDT. This one speaks the table wire at <prefix>/rest/{table}, where a table is the path and the filters are query params — the shape the console's data grid is built on.

import { base } from '@hanzo/base/rest'

const db = base('https://base.example', key)

const { data, count } = await db
  .from('posts')
  .select('id,title')
  .eq('status', 'live')
  .order('created', { ascending: false })
  .limit(20)
  .count()

Filters are eq neq gt gte lt lte like ilike is in, with .not(column, op, value) negating any of them. Writes are .insert(), .update() and .delete(), and return nothing unless .select() asks for the rows back.

Three things worth knowing, because each is where a client usually gets it wrong:

  • An unasked count is null, never 0. The server does not compute a total unless asked, so reporting zero would be inventing an answer to a question nobody put.
  • A query sends nothing until it is awaited, so a builder can be passed around and narrowed without anyone issuing a request by holding one.
  • update and delete require a filter. They act on every row the filter selects, and an unfiltered one would mean the whole table — the server refuses it rather than applying it.

Failures carry { message, details, hint, code }. code is what to branch on:

const { error } = await db.from('posts').insert({ title })
if (error?.code === '23505') return 'that title is taken'