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

@vynelix/authz-core

v0.1.0

Published

Production-grade, framework-agnostic RBAC + PBAC authorization engine with sub-microsecond evaluation latency.

Readme

@vynelix/authz-core

A production-grade, framework-agnostic authorization SDK with RBAC and PBAC support. Designed for sub-microsecond latency and high-throughput environments.

Architecture

AuthZ uses a "Dual-Engine" approach, combining hierarchical roles (RBAC) with fine-grained attribute policies (PBAC).

graph TD
    A[Context] --> B{Combined Engine}
    B --> C[RBAC Engine]
    B --> D[PBAC Engine]
    C --> E{Role Match?}
    D --> F{Policy Match?}
    E -- Yes --> G[ALLOW]
    E -- No --> H[ABSTAIN]
    F -- DENY Match --> I[DENY Overrides]
    F -- ALLOW Match --> J[ALLOW]
    F -- No Match --> K[ABSTAIN]
    G --> L{Final Decision}
    I --> L
    J --> L
    L --> |Deny Overrides| M[Result]

Features

  • RBAC Engine: Simple role hierarchy resolving multiple inheritance into static O(1) lookups.
  • PBAC Engine: Fluent policy builder (policy('post.update').when(...)) providing fine-grained access control.
  • Decision Engine: Combines RBAC and PBAC with Deny-overrides-Allow logic.
  • High Performance:
    • Policy Indexing: Grouped policy evaluation targets specific actions, avoiding linear scans.
    • Memoization: Per-request caching ready for high-load cycles.
  • Audit Hooks: Hook into the authorization lifecycle via onPreAuth and onPostAuth.
  • JSON Policies: Define logic using serializable JSON objects for dynamic/database-driven security.

Installation

npm install @vynelix/authz-core

Quick Start

1. Define your Engine

import { createAuthz, policy } from '@vynelix/authz-core';

const authz = createAuthz({
  roles: {
    guest: { can: ['post.read'] },
    user: { inherits: ['guest'], can: ['post.create'] },
    admin: { can: ['*'] }
  },
  policies: [
    policy('post.update')
      .on('post')
      .when((ctx) => ctx.user.id === ctx.resource?.ownerId)
      .build()
  ]
});

2. Perform a Check

const isAllowed = await authz.can({
  user: { id: 'usr_1', roles: ['user'] },
  action: 'post.update',
  resource: { type: 'post', ownerId: 'usr_1' }
});

API Reference

createAuthz(options)

| Option | Type | Description | | :--- | :--- | :--- | | roles | RolesConfig | Map of roles, inherited roles, and direct permissions. | | policies | PolicyDefinition[] | Array of PBAC policies (builders or JSON objects). |

authz.can(context, options)

| Argument | Type | Description | | :--- | :--- | :--- | | context | AuthzContext | { user, action, resource, meta } | | options.debug | boolean | Returns a Decision object instead of a boolean. | | options.cache | CacheProvider | Enables memoization for the evaluation. |

Why AuthZ?

| Feature | AuthZ | CASL | Oso | | :--- | :---: | :---: | :---: | | RBAC Hierarchy | ✅ | ⚠️ | ✅ | | PBAC / Attributes | ✅ | ✅ | ✅ | | Deny Overrides | ✅ | ❌ | ✅ | | Serializable Logic| ✅ | ✅ | ❌ | | O(1) Role Lookup | ✅ | ❌ | ❌ |

License

MIT