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

@torquedev/ext-search

v0.1.0

Published

Full-text search service for Torque, backed by SQLite FTS5 with a pluggable adapter pattern.

Readme

@torquedev/ext-search

Full-text search service for Torque, backed by SQLite FTS5 with a pluggable adapter pattern. Provides cross-domain search, autocomplete, and BM25 ranking with zero infrastructure required.

Install

npm install github:michaeljabbour/torque-ext-search

Peer dependencies: @torquedev/core >=0.1.0, better-sqlite3 >=11.0.0

Usage

import { SearchService } from '@torquedev/ext-search';

const searchService = new SearchService({ db, config: {
  adapter: 'fts5',  // default
}});

coordinator.registerService('search', searchService);

Bundles register searchable domains at boot:

const search = coordinator.service('search');
search.register('entities', ['name', 'type', 'status']);

Index records on write:

search.index('entities', record.id, { name: 'Acme Corp', type: 'company', status: 'active' });

Search across all domains:

search.query('acme corp');
// [{ domain: 'entities', record_id: '...', snippet: '<b>Acme</b> Corp', rank: -12.5 }]

API

register(domain, columns, options?)

Register a domain for full-text indexing. Called once per domain at bundle boot.

  • domain -- lowercase identifier (validated against /^[a-z][a-z0-9_]*$/)
  • columns -- array of column names to index
  • options.weights -- per-column ranking weights, e.g. { name: 10, status: 1 }
  • options.displayColumn -- column to return in autocomplete results

index(domain, id, fields)

Index or re-index a record. Replaces any existing entry with the same ID (upsert).

remove(domain, id)

Remove a record from the search index.

query(text, options?)

Full-text search across one or more domains. Returns results ranked by BM25 relevance.

  • options.domains -- restrict to specific domains (default: all)
  • options.limit -- max results (default: 20)
  • options.offset -- pagination offset

Returns: Array<{ domain, record_id, snippet, rank }>

autocomplete(prefix, options?)

Prefix search for typeahead. Uses FTS5 prefix queries.

  • options.domains -- restrict to specific domains
  • options.limit -- max results (default: 10)

Returns: Array<{ domain, record_id, text }>

reindex(domain, records)

Rebuild the entire index for a domain from an array of { id, fields } objects. Runs inside a transaction.

domains()

Returns an array of registered domain names.

domainInfo(domain)

Returns { columns, options } for a registered domain, or null.

Security

Domain names are validated against /^[a-z][a-z0-9_]*$/ before interpolation into SQL, preventing injection through domain names.

Exports

import { SearchService } from '@torquedev/ext-search';

Testing

npm test

ESM-only. Requires Node.js with the built-in test runner.

License

MIT