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

@mistriwork/search-postgres

v1.4.2

Published

PostgreSQL tsvector + GIN search provider pack for mistri Apps, living beside your deployment's PostgreSQL database.

Readme

@mistriwork/search-postgres

PostgreSQL tsvector + GIN as the search provider for a mistri App's search blocks.

What it is

Search is an index, never a source of truth. The index holds a copy of the fields a resource declares searchable, keyed by the record's primary key, and answers a phrase with keys; the rows are re-read from the database under the reader's own grants. The pack holds only what is PostgreSQL's:

  • PostgresTsvectorIndex: one table per collection in the database the connection names, over pg (loaded lazily on first use). Each table holds id text NOT NULL, each declared field as text, mistri_tenant text, one generated tsvector column per field (to_tsvector('simple', coalesce(field, ''))) with a GIN index per vector column, and a unique index on (id, coalesce(mistri_tenant, '')). It ranks by ts_rank with an earlier asked field weighing more and ties falling to id, and rebuilds a table under an advisory lock when a declaration adds a field. Field lists are cached per process and refreshed from the catalog when another process rebuilds the table.
  • postgresSearchConnectionOf & postgresSearch: validates connection entries and creates a SearchProvider whose close() drains open pools.

How it plugs in

Pass the provider to createHandler({ search }) from @mistriwork/mistri/handler, or plug it into a Registry with plugSearch from @mistriwork/mistri/search:

import { createHandler } from '@mistriwork/mistri/handler';
import { postgresSearch } from '@mistriwork/search-postgres';

const mistri = createHandler({
  config: './mistri.json',
  basePath: '/desk',
  publicOrigin: 'https://example.com',
  search: postgresSearch([{ name: 'pgsearch', url: '${DATABASE_URL}' }]),
});

An App names the connection in its resource:

resources: { ticket: { search: { connection: 'pgsearch', fields: ['subject', 'requester.name'] } } }

The pool is opened on first use. ${VAR} references in url expand when it opens and are never logged. The index lives in PostgreSQL tables, so it survives restarts with no reindex required.

What it is not

  • A large catalog. tsvector tables beside the deployment's database suit moderate tables. A large catalog wants a dedicated engine such as Typesense.
  • A schema-scoped runtime store. Provisioning is lazy on ensureCollection; point the connection at a dedicated database or a role with a pinned search_path when the index should not share a schema with business tables.