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

@happyvertical/smrt-products

v0.51.10

Published

SMRT products module: triple-purpose microservice template for standalone apps, federated modules, and NPM libraries

Readme

@happyvertical/smrt-products

Product catalog reference template demonstrating triple-consumption: npm package library, module federation, and standalone REST API server.

Installation

pnpm add @happyvertical/smrt-products

Usage

Import as npm library

import { Product, ProductCollection, Category } from '@happyvertical/smrt-products';
import { startServer } from '@happyvertical/smrt-products';
import { generateMCPServer } from '@happyvertical/smrt-products';
import { AssetCollection } from '@happyvertical/smrt-assets';

// Start standalone REST API server
const { shutdown } = await startServer();

const products = await ProductCollection.create();
const assets = await AssetCollection.create();
const product = await products.create({
  name: 'Demo Product',
  price: 29.99,
});
const hero = await assets.create({
  name: 'demo-product-hero.jpg',
  sourceUri: 'file:///tmp/demo-product-hero.jpg',
  mimeType: 'image/jpeg',
});

await product.addAsset(hero, 'hero');
await products.addAsset(product.id!, hero, 'gallery', 1);

Three consumption modes

  1. NPM library -- import classes, components, and stores directly
  2. Module federation -- runtime component sharing (experimental)
  3. Standalone API -- startServer() launches Express with auto-generated routes

API

Top-Level Exports

| Export | Description | |--------|------------| | startServer | Launch standalone REST API server | | generateMCPServer | Generate MCP server for AI tool integration | | demonstrateClient | Demo of auto-generated TypeScript client | | startAll | Start all services (REST + MCP) |

Models (from lib/models)

| Export | Description | |--------|------------| | Product | STI-enabled product with specs and tags | | Category | Hierarchical category (parentId, level, productCount), STI enabled | | ProductAsset | Dedicated owned-asset join stored in product_assets with relationship and sortOrder; intentionally not tenant-scoped because Product is not tenant-scoped |

Collections (from lib/collections)

| Export | Description | |--------|------------| | ProductCollection | CRUD plus findByManufacturer(), findInStock(), and owned asset wrappers | | ProductAssetCollection | Direct access to product_assets rows plus asset helper wrappers |

Components (from lib/components)

| Export | Description | |--------|------------| | ProductCard | Svelte 5 product display component | | ProductForm | Svelte 5 product edit form |

Stores (from lib/stores)

| Export | Description | |--------|------------| | ProductStoreClass | Svelte 5 rune-based state management class | | productStore | Singleton store instance |

Utilities (from lib/utils)

| Export | Description | |--------|------------| | formatPrice | Format number as USD currency string | | formatDate | Format date as human-readable string | | slugify | Convert text to URL-friendly slug | | generateId | Generate random ID string |

Virtual Modules (Vite plugin)

| Export | Description | |--------|------------| | createClient | Auto-generated TypeScript API client | | setupRoutes | Auto-generated Express routes | | createMCPServer | Auto-generated MCP server | | manifest | s-m-r-t object metadata |

Owned asset helpers are available on both Product and ProductCollection via getAssets(), addAsset(), and removeAsset(). Common relationships include hero, gallery, attachment, and thumbnail.

Dependencies

| Package | Purpose | |---------|---------| | @happyvertical/smrt-core | SmrtObject/SmrtCollection base classes, REST server, MCP generator | | @happyvertical/smrt-assets | Shared Asset / AssetCollection types used by product-owned asset helpers | | @happyvertical/sql | Database operations | | @happyvertical/ai | AI integration |