Skip to main content
TokenSmith

TokenSmith

Every app that uses JWTs ends up rewriting the same client-side plumbing — store tokens, refresh before expiry, deduplicate concurrent refresh calls, sync across browser tabs. I got tired of copy-pasting that logic, so I built TokenSmith. It's a single createTokenManager() call that handles all of it: auto-refresh with exponential backoff, cross-tab logout via BroadcastChannel, pluggable storage backends (localStorage, cookies with SameSite=Strict), and SSR support out of the box. It ships with first-class React and Vue adapters — useAuth() hooks that are concurrent-safe with zero extra renders. The whole thing is ~5 KB gzipped with zero dependencies, tree-shakeable ESM + CJS, and fully typed with TypeScript.

Technologies

TypeScript
JWT
React
Vue
npm
Open Source
Tsup
Vitest

Key Highlights

  • Published on npm — zero dependencies, ~5 KB gzipped, tree-shakeable ESM + CJS
  • Auto-refresh, cross-tab sync, and first-class React/Vue hooks out of the box

Command Palette

Search for a page or action...