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

@codeparticles/auth-sdk

v0.1.0

Published

Pre-configured Better Auth client for Code Particles apps integrating with accounts.codeparticles.ke

Downloads

23

Readme

@codeparticles/auth-sdk

Pre-configured Better Auth client for Code Particles apps that share the accounts.codeparticles.ke session cookie (via crossSubDomainCookies). If your app instead needs to integrate as a third-party OAuth client ("Login with Code Particles"), see docs/ in cp-auth instead -- this package is for first-party apps on a *.codeparticles.ke subdomain.

Install

pnpm add @codeparticles/auth-sdk

5-minute integration

// src/lib/auth.ts
import { createAuthClient } from '@codeparticles/auth-sdk';

export const { useSession, signIn, signOut, useOrganization } = createAuthClient();
// In dev, point at your local CP Auth instance instead:
// createAuthClient({ baseURL: 'http://localhost:3000' })
// src/components/Profile.tsx
import { useSession, signOut } from '../lib/auth';

export function Profile() {
  const { data: session, isPending } = useSession();

  if (isPending) return <p>Loading...</p>;
  if (!session) return <p>Signed out</p>;

  return (
    <div>
      <p>Signed in as {session.user.email}</p>
      <button onClick={() => signOut()}>Sign out</button>
    </div>
  );
}
// src/components/SignIn.tsx
import { signIn } from '../lib/auth';

export function SignIn() {
  return (
    <button onClick={() => signIn.email({ email: '[email protected]', password: '...' })}>
      Sign in
    </button>
  );
}
// src/components/CurrentOrg.tsx
import { useOrganization } from '../lib/auth';

export function CurrentOrg() {
  const { data: org } = useOrganization();
  return <span>{org?.name ?? 'No active organization'}</span>;
}

That's it -- no manual type declarations needed. session.user is fully typed, including the workspaceId field CP Auth adds on top of Better Auth's defaults.

TanStack Query integration (optional)

If your app's data layer is entirely TanStack Query and you'd rather session state live in the same cache (shared invalidation, devtools) than in Better Auth's own reactive store:

import { createAuthClient, useSessionQuery } from '@codeparticles/auth-sdk';

const authClient = createAuthClient();

function Profile() {
  const { data: session } = useSessionQuery(authClient);
  // ...
}

This is purely additive -- useSession works fine standalone, with or without a QueryClientProvider in the tree. Use useSessionQuery only if you specifically want session state to live in TanStack Query's cache.

What's included

  • createAuthClient(options?) -- factory, defaults baseURL to https://accounts.codeparticles.ke
  • useSession, signIn, signOut, signUp -- Better Auth's own reactive hooks/actions
  • useOrganization -- alias for Better Auth's useActiveOrganization
  • useListOrganizations -- list all orgs the current user belongs to
  • useSessionQuery -- optional TanStack Query-backed alternative to useSession

What's not included

Provider-side plugins (2FA enrollment, passkeys, SSO, the OAuth provider itself, admin actions) are intentionally left out -- those are for building accounts.codeparticles.ke's own UI, not for consuming it. If your app needs one of those, talk to the CP Auth team before reaching for a lower-level Better Auth client directly.