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-sites

v0.36.0

Published

Site lifecycle management for multi-tenant SMRT networks

Readme

@happyvertical/smrt-sites

Site lifecycle management for multi-tenant SMRT networks. Manages deployable websites with provisioning status, tier classification, portal configuration, and agent bindings with priority ordering.

Installation

pnpm add @happyvertical/smrt-sites

Usage

import {
  Site, SiteCollection,
  SiteAgentBinding, SiteAgentBindingCollection,
  SiteService
} from '@happyvertical/smrt-sites';

// Create collections
const sites = await SiteCollection.create({ db });
const bindings = await SiteAgentBindingCollection.create({ db });

// Use SiteService for lifecycle operations
const service = new SiteService({ sites, bindings });

// Create a site (starts in draft status)
const site = await service.createSite('tenant-123', {
  name: 'Community Hub',
  domain: 'hub.example.com',
  tier: 'standard',
});

// Activate after validation (requires name + domain)
await service.activateSite(site.id);

// Mark infrastructure as provisioned
await service.markProvisioned(site.id);

// Bind agents with priority ordering (higher = first)
await service.bindAgent(site.id, 'Praeco', { schedule: '0 * * * *' });
await service.bindAgent(site.id, 'Caelus', { maxArticles: 50 });

// Get enabled agents sorted by priority descending
const agents = await service.getEnabledAgents(site.id);

// Suspend or archive a site
await service.suspendSite(site.id);
await service.archiveSite(site.id);

Site lifecycle

Sites progress through four statuses: draft -> active -> suspended -> archived. The SiteService enforces validation on activation (name and domain required) and tracks provisioning state separately via provisioningStatus (pending/provisioning/ready/failed). Sites are uniquely identified by (tenant_id, domain).

Agent bindings

SiteAgentBinding is a junction table linking sites to agent classes. Each binding has a priority (higher values execute first), an enabled flag, and optional per-site config overrides stored as JSON. The bindAgent() method upserts -- updating config if a binding already exists, creating one if not. findEnabled() returns bindings sorted by priority descending.

Portal configuration

Sites store theme, branding, and navigation settings in portalConfig as JSON. Use getPortalConfig()/setPortalConfig() for type-safe access. Both models require tenant context (@TenantScoped({ mode: 'required' })).

API

Models

| Export | Description | |--------|------------| | Site | Site record with domain, status, tier, provisioning tracking, and portal config | | SiteAgentBinding | Junction binding an agent class to a site with priority and config overrides |

Collections

| Export | Description | |--------|------------| | SiteCollection | CRUD and queries for Site records | | SiteAgentBindingCollection | Queries by site, agent class, and enabled state with priority sorting |

Services

| Export | Description | |--------|------------| | SiteService | High-level lifecycle ops: create, activate, suspend, archive, bind/unbind agents |

Key Types

SiteOptions, SiteStatus, SiteTier, ProvisioningStatus, SitePortalConfig, SiteServiceOptions, SiteAgentBindingOptions, CreateSiteData

Dependencies

  • @happyvertical/smrt-core -- ORM and code generation
  • @happyvertical/smrt-tenancy -- required multi-tenant scoping
  • Peer: @happyvertical/smrt-agents (optional)