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

@authabase/react

v0.2.0

Published

Reusable React auth components with Supabase integration, shadcn UI, and configurable auth methods

Readme

AuthABase React Library

Reusable, type-safe React authentication components with Supabase integration, Tailwind-powered styling, and configurable auth flows.

What Is Included

  • AuthProvider and useAuth
  • Auth forms: LoginForm, SignupForm, OTPForm, MagicLinkForm, ForgotPasswordForm, ResetPasswordForm
  • UI and helpers: SocialAuthButton, AuthContainer, EmailInput, PasswordInput
  • Headless hooks: useLoginForm, useSignupForm, useOTPFlow
  • Utility: createSupabaseClient

Core Features

  • Email/password authentication
  • Google OAuth and GitHub OAuth
  • OTP via email or phone
  • Magic link sign-in
  • Forgot password and reset password flows
  • Configurable enabled auth methods
  • TypeScript-first API
  • Built-in Google/GitHub SVG icons for social auth buttons
  • Form lifecycle hooks and error mapping
  • Per-form copy overrides for i18n/custom UX text

Installation

Install package:

npm install @authabase/react

Install peer dependencies:

npm install react react-dom tailwindcss@^4

This library supports Tailwind CSS 4.x.

Import package styles once in your app entry:

import '@authabase/react/styles.css'

The components work out of the box with built-in default styles. Overriding the theme is optional.

Quick Start

import { AuthProvider, AuthContainer, LoginForm } from '@authabase/react'

export function App() {
  return (
    <AuthProvider
      config={{
        supabaseUrl: import.meta.env.VITE_SUPABASE_URL,
        supabaseKey: import.meta.env.VITE_SUPABASE_KEY,
        redirectUrl: window.location.origin,
        enabledMethods: {
          email: true,
          google: true,
          github: true,
          otp: true,
        },
      }}
    >
      <AuthContainer title="Welcome Back" subtitle="Sign in to continue">
        <LoginForm showSignupLink showForgotPasswordLink />
      </AuthContainer>
    </AuthProvider>
  )
}

API Highlights

AuthProvider Config

interface AuthConfig {
  supabaseUrl: string
  supabaseKey: string
  redirectUrl?: string
  enabledMethods?: Partial<{
    email: boolean
    google: boolean
    github: boolean
    otp: boolean
  }>
  onAuthSuccess?: (user: AuthUser) => void
  onAuthError?: (error: Error) => void
}

Login and Signup Navigation

LoginForm supports:

  • showSignupLink
  • onSignupClick
  • signupHref
  • showForgotPasswordLink
  • onForgotPasswordClick
  • forgotPasswordHref

SignupForm supports:

  • showLoginLink
  • onLoginClick
  • loginHref

OTPForm

OTPForm supports both Supabase-backed OTP and custom backend callbacks.

  • strategy.mode: supabase (default) or custom
  • strategy.requestOTP(payload) and strategy.verifyOTP(payload) for custom mode
  • options.enabledMethods for OTP delivery: email, phone
  • options.resendCountdownSeconds
  • options.otpLength
  • options.otpInputMode: segmented (default) or single
  • options.autoSubmitOnComplete

Example with custom OTP backend:

import { OTPForm } from '@authabase/react'

export function CustomOtp() {
  return (
    <OTPForm
      options={{
        otpInputMode: 'segmented',
        otpLength: 6,
      }}
      strategy={{
        mode: 'custom',
        requestOTP: async (payload) => {
          await fetch('https://api.example.com/otp/request', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify(payload),
          })
        },
        verifyOTP: async (payload) => {
          const res = await fetch('https://api.example.com/otp/verify', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify(payload),
          })
          if (!res.ok) throw new Error('OTP verification failed')
          return (await res.json()) as {
            id: string
            email?: string
            phone?: string
            user_metadata?: Record<string, unknown>
          }
        },
      }}
    />
  )
}

Shared Form Lifecycle Props

All form components support:

  • onSubmitStart
  • onSubmitComplete
  • onValidationError
  • mapError

Password Policy Props

SignupForm and ResetPasswordForm support:

  • minPasswordLength
  • requireUppercase
  • requireLowercase
  • requireNumber
  • requireSpecialChar

Copy Overrides

All auth forms support a copy prop so labels, button text, prompts, and status messages can be customized.

Headless Hooks

import { useLoginForm, useSignupForm, useOTPFlow } from '@authabase/react'

These hooks expose state, validation, and submit handlers so you can build fully custom UIs while keeping auth logic in one place.

Component Exports

Primary package entry exports:

  • Types
  • AuthProvider, useAuth
  • LoginForm, SignupForm, OTPForm, MagicLinkForm, ForgotPasswordForm, ResetPasswordForm
  • SocialAuthButton, AuthContainer
  • EmailInput, PasswordInput
  • useLoginForm, useSignupForm, useOTPFlow
  • createSupabaseClient

Lower-level UI primitives such as InputOTP are available from the components entrypoint:

import { InputOTP, InputOTPGroup, InputOTPSlot } from '@authabase/react/components'

Theming

The library ships with default auth styles, so consumers do not need to define shadcn-style theme tokens just to make components render correctly.

To match your app theme, override the --auth-* variables in your global CSS after importing @authabase/react/styles.css.

:root {
  --auth-primary: #2563eb;
  --auth-primary-foreground: #ffffff;
  --auth-surface: #ffffff;
  --auth-border: #cbd5e1;
  --auth-muted-fg: #64748b;
  --auth-link: #2563eb;
  --auth-link-hover: #1d4ed8;
  --auth-danger-bg: #fff1f2;
  --auth-danger-fg: #be123c;
  --auth-success-bg: #ecfdf5;
  --auth-success-fg: #047857;
}

Most consumers only need a few variables:

  • --auth-primary
  • --auth-primary-foreground
  • --auth-surface
  • --auth-border
  • --auth-link
  • --auth-link-hover

The remaining --auth-* variables control muted text, inputs, social buttons, success states, and error states.

Development

From the package folder:

npm install
npm run dev
npm run type-check
npm run test
npm run build

Publishing Scripts

The package includes helper scripts for release flow:

  • release:whoami
  • release:check
  • release:dry-run
  • release:publish

Example:

npm run release:dry-run --workspace @authabase/react
npm run release:publish --workspace @authabase/react -- --otp=123456

License

MIT