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

@classytic/review

v0.3.1

Published

Framework-agnostic polymorphic review + rating engine — one engine for ecom product reviews, food/restaurant reviews, ride/driver reviews, traveler/sender reviews. Host-configurable subjects, facets, moderation, eligibility. Powered by MongoDB via @clas

Readme

@classytic/review

Framework-agnostic polymorphic review + rating engine. One engine for every review shape — ecom product reviews, food/restaurant reviews, ride/driver reviews, traveler↔sender reviews — all host-configurable. MongoKit repositories are the primitive; arc auto-CRUD works directly; Zod schemas (at the /schemas subpath) feed auto-OpenAPI.

Install

npm i @classytic/review
# peers
npm i @classytic/mongokit @classytic/repo-core @classytic/primitives mongoose zod

Quick start

import mongoose from 'mongoose';
import { createReview } from '@classytic/review';

const reviews = await createReview({
  connection: mongoose.connection,
  ratingScale: { min: 1, max: 5 },          // default
  subjects: ['product', 'driver', 'restaurant'], // optional allowlist (undefined = any)
  facets: { driver: ['punctuality', 'cleanliness', 'driving'] },
  moderation: { defaultStatus: 'published' },    // or 'pending'
  modules: { summary: true, helpfulness: true, response: true },
  eligibility: myVerifiedPurchaseBridge,         // optional gate
});

// Repositories ARE the domain layer
await reviews.repositories.review.submit(
  { subjectType: 'product', subjectId: 'SKU-1', raterId: 'u1', rating: 5, body: 'Great' },
  ctx,
);

const summary = await reviews.getSummary('product', 'SKU-1', ctx);
// { count, avg, ratingSum, distribution: { '5': 1 }, ... }

Engine surface

| Member | Description | |---|---| | reviews.models.{Review,ReviewSummary} | Connection-scoped Mongoose models | | reviews.repositories.review | submit / edit / moderate / respond / voteHelpful / flag / remove | | reviews.repositories.summary | applyDelta / recompute / getSummary (present when modules.summary) | | reviews.events | arc-compatible EventTransport — subscribe to review:* | | reviews.getSummary(subjectType, subjectId, ctx) | Read the rollup | | reviews.canReview(input, ctx) | Probe the eligibility bridge | | reviews.syncIndexes() | Idempotent index sync | | reviews.disconnect() | Graceful shutdown |

Polymorphic subject

(subjectType, subjectId) are plain strings + an optional eligibility bridge — never a Mongoose refPath/ObjectId. The subject collection varies per host (a product, a driver, a restaurant, a traveler) and is never coupled into the kernel. Verified-purchase / verified-ride linkage flows through the EligibilityBridge decision ({ allowed, verified?, sourceType?, sourceId? }) and is stamped onto the review.

Summary rollup

ReviewSummary is maintained incrementally. Whenever a review enters / leaves the counted set (published | flagged) or changes its rating while counted, ReviewSummaryRepository.applyDelta(...) runs under the same ctx.session and applies a single atomic update: all $inc deltas plus an aggregation-pipeline recompute of avg = ratingSum / count in one round-trip, so avg can never drift. recompute(...) re-aggregates from source reviews as a repair path.

Events

review:review.submitted | .edited | .moderated | .responded | .voted | .flagged | .removed and review:summary.changed. Each ships a Zod-backed definition in reviewEventDefinitions (importable from . or @classytic/review/events) — register them with arc's EventRegistry.

License

MIT