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

hexok

v2.1.0

Published

TypeScript primitives for hexagonal software: Schema, Entity, UseCase, Port, Adapter, Mapper, Event, EventCatalog, EventHandler, and Errors.

Readme

hexok

TypeScript primitives for hexagonal software: Schema, Entity, UseCase, Port, Adapter, Mapper, Event, EventCatalog, EventHandler, and Errors. A Mapper subclass implements fromSource and toSource; adapters call toModel and fromModel.

Import them from hexok. There is no HTTP layer and no composition root in this package. Construct use cases with the ports they need. A schema argument is a Standard Schema. Zod satisfies that interface. @hexok/typebox adapts a typebox 1 schematic: typebox(schema) infers Static, and typeboxDecode(schema) infers StaticDecode and decodes. EventInstance<typeof Catalog> is the catalog's event objects. EventMessage<typeof Catalog> is the { key, payload } union an adapter sends. message and parse on the catalog convert between them.

UseCase.context<Ctx, Spec>() is a family factory for a per-call context, optional guards, optional hooks, and required statics. The optional argument is a settings object with no keys yet. Pass nothing. {} is allowed. guard and hooks are methods, not fields of that object. A missing <Ctx> type argument is a type error. Spec defaults to no required statics. .guard(fn) and .hooks(def) each return the same factory. Order does not matter. Either may be omitted. Another .guard() runs after guards already registered. A second .hooks() throws hexok: UseCase hooks are already set when the factory is created, if the first registration had at least one callback. An empty .hooks({}) does not register hooks and does not wrap execute. The call is { ctx, spec, token, input }. input is the argument passed to execute. The method receives that same value. Hexok does not validate it. UseCase.GuardParameters<typeof Factory> is that call. UseCase.Ctx<typeof Factory> is that ctx. Pass the factory. .hooks infers the value returned from preExecute as the state argument of postExecute, onCatch, and onFinally. If preExecute is omitted, that state is void. postExecute also receives result. onFinally receives status: 'success' with result, or status: 'failure' with error. The pipeline is guard (outside try), preExecute, the method, postExecute, onCatch then rethrow, onFinally. A guard throw does not enter the hooks. A throw inside onCatch replaces the error after onFinally sees the original one. UseCase(token) still has execute(input).

Agent skill

This package's repository includes an agent skill named hexok. It walks a feature from the user story through entities, use cases, events, adapters, the gateway, and where handlers run. Install it from GitHub. npx skills update refreshes that install from GitHub.

npx skills add crobinson42/hexok
npx skills update

The root README shows the shape. Tokens and schemas are arguments of each primitive, so they cannot be forgotten. execute, handle, and port methods are abstract, so a missing method is a compiler error on the class. start, stop, parse, and set are concrete methods you can override.