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

@better-iam/client

v0.2.0

Published

Typed, browser-safe client for the Better IAM HTTP API, inferred from your server instance, with a session store and passkey helpers.

Readme

@better-iam/client

Browser-safe typed client for Better IAM. It depends on no server runtime. Import your configured server instance as a type so database and authentication code are excluded from browser bundles.

import { createIamClient } from '@better-iam/client';
import type { iam } from './server.js';

const client = createIamClient<typeof iam>({ baseURL: 'https://app.example.com' });
const { tenantId } = await client.tenants.lookup({ slug: 'acme' }); // public alias discovery for login screens
const result = await client.auth.signIn({ tenantId, email: '[email protected]', password });
const current = await client.auth.getSession();
const decision = await client.authorize({
  tenantId,
  action: 'documents:read',
  resource: { type: 'document', id: 'doc-id' },
});
const { results } = await client.authorizeMany({
  tenantId,
  checks: [{ action: 'documents:write', resource: { type: 'document', id: 'doc-id' } }],
});
const accounts = await client.links.list(); // linked identities in other organizations, for an account switcher

Member invitations are redeemed without a session: client.identities.acceptInvitation({ tenantId, token, name, password }) creates the account, applies the invited roles, and signs the person in. Cookies use Fetch's credentials: 'include'. For service or bearer sessions, provide token: () => currentToken; the client never writes tokens to browser storage. The server still authenticates and authorizes every call. Client permission decisions are advisory.

Requests use POST /api/iam/{group}/{method} with the input as the JSON body, Content-Type: application/json, and X-Better-IAM: 1. You can configure basePath, headers, Fetch, and per-call cancellation. IamClientError exposes code, message, and HTTP status. Plugin routes use client.$request<Result>('plugins/my-plugin/action', input).

WebAuthn ceremony helpers are exported separately from @better-iam/client/passkeys:

import { startRegistration } from '@better-iam/client/passkeys';
const challenge = await client.auth.beginPasskeyRegistration();
const response = await startRegistration({ optionsJSON: challenge.options });
await client.auth.finishPasskeyRegistration({ challengeId: challenge.challengeId, response });

For MFA enrollment after a restricted login challenge, call client.auth.beginMfa({ tenantId, challenge }), then client.auth.confirmMfa({ credential: { tenantId, challenge }, code }). During an authenticated session, call beginMfa() and confirmMfa({ code }).