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

@org.ai/react

v0.1.0

Published

React SDK for id.org.ai — Agent-First Identity

Readme

@org.ai/react

React SDK for id.org.ai — Agent-First Identity.

Provides authentication, organization management, and access tokens via TanStack Query-powered hooks.

Install

npm install @org.ai/react @tanstack/react-query react

Quick Start

import { IdProvider, useAuth, useOrganizations } from '@org.ai/react'

function App() {
  return (
    <IdProvider clientId="your_client_id">
      <YourApp />
    </IdProvider>
  )
}

function YourApp() {
  const { user, isAuthenticated, isLoading, signIn, signOut, getAccessToken } = useAuth()
  const { organizations, switchOrganization, createOrganization } = useOrganizations()

  if (isLoading) return <div>Loading...</div>
  if (!isAuthenticated) return <button onClick={() => signIn()}>Sign In</button>

  return (
    <div>
      <p>Hello {user.email}</p>
      <button onClick={() => signOut()}>Sign Out</button>
    </div>
  )
}

API

<IdProvider>

Wrap your app to provide auth context. Creates its own QueryClient.

| Prop | Type | Description | |------|------|-------------| | clientId | string | OAuth client ID (required) | | baseUrl | string | API base URL (default: https://id.org.ai) | | redirectUri | string | OAuth redirect URI (default: {origin}/callback) | | onRedirectCallback | (ctx: { user, state }) => void | Called after successful OAuth callback |

useAuth()

Returns the current auth state and actions.

const {
  user,              // AuthUser | null
  isLoading,         // boolean
  isAuthenticated,   // boolean
  error,             // Error | null
  accessToken,       // string | null (auto-refreshes before expiry)
  organizationId,    // string | null
  permissions,       // string[]
  signIn,            // (opts?) => Promise<void>
  signOut,           // (opts?) => Promise<void>
  getAccessToken,    // () => Promise<string>
} = useAuth()

signIn options:

signIn({
  organizationId: 'org_123',       // Pre-select organization
  returnTo: '/dashboard',          // Post-login redirect path
  state: { custom: 'data' },       // Custom state passed through OAuth flow
})

useOrganizations()

Manage organizations for the authenticated user.

const {
  organizations,        // Organization[]
  isLoading,            // boolean
  error,                // Error | null
  switchOrganization,   // (orgId: string) => Promise<void>
  createOrganization,   // (name: string) => Promise<Organization>
  isCreating,           // boolean
} = useOrganizations()

Switching organizations automatically invalidates the access token and refreshes the session.

Advanced: Direct Client

For non-hook usage (e.g., in event handlers outside React tree):

import { createIdClient } from '@org.ai/react'

const client = createIdClient('https://id.org.ai')
const session = await client.fetchSession()
const token = await client.fetchWidgetToken()

Auth Flow

Uses OAuth 2.1 Authorization Code + PKCE (S256):

  1. signIn() generates a PKCE verifier/challenge and state nonce
  2. Redirects to id.org.ai/oauth/authorize
  3. User authenticates (WorkOS AuthKit — SSO, social, MFA)
  4. Redirected back with authorization code
  5. IdProvider exchanges code for session (httpOnly cookie)
  6. useAuth() returns the authenticated user

Types

interface AuthUser {
  id: string
  email: string
  firstName: string | null
  lastName: string | null
  profilePictureUrl: string | null
  emailVerified: boolean
  organizationId: string | null
  role: string | null
  permissions: string[]
  createdAt: string
  updatedAt: string
}

interface Organization {
  id: string
  name: string
  slug: string
  role: string
  domains: string[]
}

Requirements

  • React 18+ or 19+
  • @tanstack/react-query 5+

License

MIT