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

@simple-auth-kit/auth-client

v2.1.0

Published

Shared, framework-agnostic auth API client for the simple-auth-kit backend. Used by all 4 client apps (admin-nextjs, admin-react, mobile-expo, mobile-bare-rn) — the auth flow and API contract are identical across them, only the injected TokenStorage adapt

Readme

@simple-auth-kit/auth-client

Shared, framework-agnostic auth API client for simple-auth-kit backends. Used by every client app in the repo (admin-nextjs, admin-react, mobile-expo, mobile-bare-rn) — the auth flow and API contract are identical across them; only the injected TokenStorage adapter differs per platform (cookies-next on web, AsyncStorage on mobile).

Install

npm install @simple-auth-kit/auth-client

Package: https://www.npmjs.com/package/@simple-auth-kit/auth-client

Clone the source

This is a standalone copy, published from the monorepo. To pull just this package's source without cloning the whole repo:

npx degit shahriar-ratul/simple-auth-kit/packages/auth-client auth-client

Usage

baseUrl and storage are required — this package has no default backend URL and no built-in storage. You provide both, from your own app's config:

  • baseUrl: a plain string — this package doesn't read any env var itself, so how you produce that string is entirely up to your own setup. The only real question is how your build tool gets an env value into browser-run JS in the first place:

    | Your setup | How to expose the value | |---|---| | Node.js backend (SSR, BFF, server-only code) | process.env.AUTH_API_URL directly — no build step needed | | Next.js | prefix it NEXT_PUBLIC_* — only those are inlined into the browser bundle | | Vite | prefix it VITE_*, read via import.meta.env.VITE_AUTH_API_URL | | CRA / plain webpack | REACT_APP_* (CRA) or whatever your DefinePlugin rule exposes | | Expo | prefix it EXPO_PUBLIC_* | | Bare React Native | no built-in env support — use react-native-config (native build step) or react-native-dotenv (Babel plugin) | | Plain <script>, no bundler | can't inline env vars at all — hardcode it, have your server inject it (e.g. <script>window.__ENV__={API_URL:"..."}</script>), or fetch('/config.json') at runtime |

    Whichever string you end up with, that's the entire integration — pass it as baseUrl below. process.env.AUTH_API_URL in the snippet is illustrative, not a name this package looks for.

  • storage: a small object implementing { get, set, clear } (see TokenStorage in types.ts) — e.g. cookies on web, AsyncStorage on mobile. This package ships no implementation; you write the one that fits your platform.

import { AuthClient } from "@simple-auth-kit/auth-client";

const auth = new AuthClient({
  baseUrl: process.env.AUTH_API_URL!, // wherever *your* backend is deployed — read via your own framework's env convention
  storage: myTokenStorageAdapter, // your own TokenStorage implementation — platform-specific (cookies, AsyncStorage, ...)
});

Pair it with any simple-auth-kit backend combo (nestjs-prisma, nestjs-drizzle, express-prisma, express-drizzle) — the API contract is the same across all four.

baseUrl is read once, at construction, and kept on the instance — no method takes it as an argument. Construct one AuthClient at app startup (a module-level singleton, as every app in this repo does) and import that same instance everywhere else:

// lib/auth-client.ts — built once, when this module first loads
export const authClient = new AuthClient({ baseUrl: AUTH_API_URL, storage: cookieTokenStorage });

// every other call site — just import and use; baseUrl is never mentioned again
await authClient.login({ identifier, password });
await authClient.me();

Development

npm install
npm run build       # tsc -> dist/
npm run typecheck
npm run test         # vitest

Source

Full source and every consuming app: simple-auth-kit.