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

@hetuh/ext-orgws

v0.3.0

Published

Better Auth organization & workspace plugin — cached orgs, local workspaces, dynamic RBAC, invitations

Readme

@hetuh/ext-orgws

A Better Auth plugin that extends the built-in organization plugin with a workspace layer, dynamic role-based access control, and an optional membership-sync cache for apps that delegate identity to an upstream auth server.

Drop-in replacement for better-auth/plugins/organization — it keeps the full organization/team/member/invitation API and adds workspaces and dynamic RBAC on top.

Install

npm install @hetuh/ext-orgws
# peer dependency (1.7+ — the plugin uses 1.7's atomic adapter operations):
npm install better-auth

What it adds

  • Workspaces — a sub-organization grouping (workspace, workspaceMember, teamWorkspaceAccess) with their own CRUD, membership, and invitation endpoints.
  • Dynamic access control — roles/permissions stored in a dynamicRole table, editable at runtime, on top of Better Auth's static ac statements.
  • Membership sync — optional upsert-based caching of organizations, teams, and members fetched from an upstream auth server (on login, on stale TTL, or on demand), so a downstream app can mirror identity without owning it.

Usage

Server

import { betterAuth } from 'better-auth'
import { organization } from '@hetuh/ext-orgws'

export const auth = betterAuth({
  // ...
  plugins: [
    organization({
      teams: { enabled: true },
      workspaces: { enabled: true },
      dynamicAccessControl: { enabled: true },
      // optional: mirror memberships from an upstream auth server
      sync: {
        fetchMemberships: async (userId) => fetchFromUpstream(userId),
        syncOnLogin: true,
        staleTtlMs: 4 * 60 * 60 * 1000,
      },
    }),
  ],
})

Client

import { createAuthClient } from 'better-auth/client'
import { organizationClient } from '@hetuh/ext-orgws/client'

export const authClient = createAuthClient({
  plugins: [organizationClient()],
})

Relationship to Better Auth

This package extends and is derived in part from Better Auth's organization plugin. Treat its organization/team/member/invitation surface as compatible with Better Auth's; the workspace and dynamic-RBAC surface is the addition.

Tracks Better Auth 1.7: race-free team capacity via atomic seat reservation (team.memberCount counter + unique teamMember.membershipKey), the lightweight GET /organization/get-organization endpoint, and list-user-teams with userId/organizationId query parameters. See CHANGELOG.md for the schema migration notes.

License

MIT — see LICENSE. Includes portions derived from Better Auth (MIT).