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

@programisto/edrm-search

v1.0.0

Published

EDRM module for full-text search via OpenSearch/Elasticsearch, synced from Endurance schema events

Readme

EDRM Search

Description

EDRM Search is an Endurance module that provides full-text search via OpenSearch (or Elasticsearch). It listens to Endurance schema events (postSave, postDeleteOne) to keep search indexes in sync with MongoDB collections. Search is exposed through the Endurance search middleware, so other EDRM modules can call search without depending on edrm-search.

Features

  • Automatic index sync: documents are indexed on save and removed on delete.
  • One index per MongoDB collection (with optional prefix).
  • Search via middleware: use EnduranceSearchMiddleware.getInstance().search(collection, options) in any module.
  • Optional unified route POST /search (disabled by default; enable with EDRM_SEARCH_ROUTES_ENABLED=true).

Installation

npm install @programisto/edrm-search

Requirements

  • @programisto/endurance ≥ 1.0.x (with EnduranceSearchMiddleware and postSave / postDeleteOne events)
  • Node.js ≥ 18
  • OpenSearch (or compatible) cluster

Environment Variables

| Variable | Required | Default | Description | | -------- | -------- | ------- | ----------- | | SEARCH_ENGINE_URL | Yes (if search enabled) | - | OpenSearch/Elasticsearch cluster URL (e.g. https://localhost:9200) | | SEARCH_ENGINE_ENABLED | No | - | Set to true to enable indexing and the search provider | | SEARCH_ENGINE_INDEX_PREFIX | No | '' | Prefix for index names (e.g. app_app_users) | | SEARCH_ENGINE_PROVIDER | No | opensearch | opensearch or elasticsearch | | SEARCH_ENGINE_USERNAME | No | - | Basic auth username | | SEARCH_ENGINE_PASSWORD | No | - | Basic auth password | | EDRM_SEARCH_ROUTES_ENABLED | No | false | Set to true to enable the /search HTTP routes (disabled by default for security) |

Using search from another module (middleware)

In any EDRM module, use the Endurance search middleware so you do not depend on edrm-search:

import { EnduranceSearchMiddleware } from '@programisto/endurance';

// In a route handler:
const provider = EnduranceSearchMiddleware.getInstance();
if (provider.isSearchEnabled()) {
  const result = await provider.search('users', { q: req.query.q, size: 20 });
  res.json(result);
} else {
  // Fallback to Model.find() or other logic
}

Routes (when enabled)

When EDRM_SEARCH_ROUTES_ENABLED=true:

  • POST /search – Body: { collection, q?, filter?, sort?, from?, size?, body? }
  • GET /search – Query: collection (required), q, filter, sort, from, size

By default these routes return 503 with code: "SEARCH_ROUTES_DISABLED" so that search is used only via the middleware from your modules.

Collection name convention

If the document does not expose a collection name via constructor.getModel().collection.name, the listener derives it from the event name (e.g. User:postSave → collection users).