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

stratifyjs

v4.0.1

Published

Enforce architectural layer boundaries in monorepos

Readme

Stratify

Enforce architectural layer boundaries in monorepos by checking package-to-package dependencies declared in package.json. Assign packages to layers, define permitted target layers, and run the CLI or API in your tooling or CI. By default, StratifyJS checks workspace: dependencies; it does not scan source imports.

Installation

Node.js is required. This repository's CI uses Node.js 24.x; a minimum supported version and exact Node/Yarn versions are not pinned. See contributor setup for the source-backed environment details.

npm install stratifyjs
# or
yarn add stratifyjs

For CLI-only usage, you can install globally with npm install -g stratifyjs. The npm package is stratifyjs, but its executable is stratify.

Quick Start

StratifyJS reads package manifests; you do not need to install these example packages' dependencies to check them.

  1. Create two packages under packages/, each with a "layer" field:

packages/feature/package.json:

{
    "name": "@example/feature",
    "version": "1.0.0",
    "layer": "features",
    "dependencies": {
        "@example/core": "workspace:*"
    }
}

packages/core/package.json:

{
    "name": "@example/core",
    "version": "1.0.0",
    "layer": "core"
}
  1. Create stratify.config.json at the workspace root:
{
    "layers": {
        "features": {
            "allowedDependencies": ["core"]
        },
        "core": {
            "allowedDependencies": []
        }
    },
    "enforcement": {
        "mode": "error"
    }
}

This permits features to depend on core. By intentional policy, same-layer dependencies need explicit permission: a layer must list itself in allowedDependencies, or use "*", for its packages to depend on each other. An empty list permits none.

  1. Run from the workspace root:
npx --package=stratifyjs stratify --config stratify.config.json

For this two-package example, expect two discovered packages, no violations, and exit code 0. Default discovery looks under packages/; customize it using the configuration reference.

CLI and API

For machine-readable CLI output:

npx --package=stratifyjs stratify --mode error --format json

Completed validation writes one JSON result to stdout. Ordinary violations in error mode exit 1; fatal errors instead use stderr with empty stdout. See the CLI reference for all options, output contracts, exit codes, and CI examples.

From an ES module or TypeScript integration:

import { validateLayers } from 'stratifyjs';

const result = await validateLayers({ workspaceRoot: '.' });
console.log(result.violations);

The API returns ordinary violations in both warn and error modes; callers decide whether to fail. See the API reference for options, public types, accepted exceptions, mode semantics, and errors.

Documentation

These reference pages are maintained in the repository; docs/ is not included in the installed npm package.

| Guide | Contents | | --- | --- | | Configuration | Layers, defaults, discovery/scan limits, dependency fields and protocols, allowlists, and exceptions | | CLI | Options, output, exit codes, and CI integration | | API | Library examples, options, result types, modes, and errors | | Architecture | Source modules, validation flow, and implementation caveats | | Contributing | Setup, validation commands, change files, and releases |

Contributing

See CONTRIBUTING.md. Changes need a Beachball change file unless all changed paths match the exemptions in beachball.config.cjs, including test-only changes under src/**/__tests__/**; that config is the source of truth.

License

MIT