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

@substrat-run/kernel

v0.83.0

Published

Substrat kernel contracts and services — pure TypeScript, no platform imports (D-14)

Readme

@substrat-run/kernel

Kernel contracts and services for Substrat — the hard parts of vertical B2B SaaS (tenancy, permissions, audit, GDPR), hosted and enforced at runtime.

This package defines the behavioral seams of the kernel in pure TypeScript. It imports no platform APIs — Cloudflare specifics live only in adapters, and every adapter must pass the same conformance suite (@substrat-run/contract-tests).

Full documentation: https://substrat.net/reference/kernel

The scope-host contract

A scope is one isolation domain (a BRF, a filial, a brand) with its own SQLite database. Module code registers operations; callers reach a scope only through a capability stub minted by the host:

import type { ScopeHost } from '@substrat-run/kernel';

host.defineOperation('workorder/create', async (ctx, input) => {
  await ctx.check('workorder:create');      // ambient principal + scope
  ctx.sql.exec('INSERT INTO work_orders ...');
  ctx.emit({ type: 'workorder.created', ... }); // envelope stamped kernel-side
});

const stub = await host.getScope(principal, tenantId, scopeId); // fails closed on mismatch
await stub.invoke('workorder/create', input);

Handlers run inside the scope's execution domain (a Durable Object in production, a per-scope actor locally) — one network hop, then local queries.

Contract semantics (what adapters must guarantee)

  • Strict serialization per scope — one operation at a time, to completion.
  • Structured-clone boundary — inputs and results are cloned even in-process; code can never share mutable state with a scope.
  • Kernel-stamped events — id, timestamp, tenant, scope, and actor are stamped below the API surface; callers cannot mislabel an event's origin.
  • Fail-closed addressing — a mismatched (tenantId, scopeId) pair throws; it never resolves to another tenant's scope.

Also exported: the PermissionChecker seam (with a secure-default denyAllChecker and a deliberately alarming UNSAFE_allowAllChecker for tests) and a dependency-free ulid().

Related packages

Status

Pre-release (0.x): interfaces change without notice until the first vertical ships.