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 🙏

© 2025 – Pkg Stats / Ryan Hefner

better-auth-waitlist

v3.0.1

Published

A lightweight Better Auth plugin for waitlist management with admin approval workflows, domain restrictions, and customizable validation.

Readme

Better Auth Waitlist Plugin

npm version

A production-ready Better Auth plugin that provides a comprehensive waitlist system with admin approval workflows, domain restrictions, and customizable validation.

💡 Inspired by: Better Auth Kit Waitlist Plugin - This implementation follows similar patterns and conventions.

Bundle Size

📦 Lightweight & Optimized

| Metric | Size | |--------|------| | Minified | ~22 kB | | Gzipped | ~3.5 kB | | Dependencies | 1 (zod only) | | Modules | ESM |

💡 Tip: Check the impact on your bundle with Bundle Analyzer or use npm ls to see the dependency tree.

Installation

npm install better-auth-waitlist

or

pnpm add better-auth-waitlist

or

yarn add better-auth-waitlist

Quick Start

1. Add the Plugin to Better Auth

import { betterAuth } from "better-auth";
import { waitlist } from "better-auth-waitlist";

export const auth = betterAuth({
  plugins: [
    waitlist({
      enabled: true,
      allowedDomains: ["@example.com", "@company.org"],
      maximumWaitlistParticipants: 1000,
    }),
  ],
});

2. Run Database Migration

Create the waitlist table:

npx @better-auth/cli migrate

3. Setup Client Plugin

import { createAuthClient } from "better-auth/react";
import { waitlistClient } from "better-auth-waitlist/client";

export const authClient = createAuthClient({
  baseURL: process.env.NEXT_PUBLIC_AUTH_URL,
  plugins: [waitlistClient()],
});

4. Use in Your Application

// Join the waitlist
const result = await authClient.waitlist.join({
  email: "[email protected]",
  department: "Engineering",
  name: "Jane Smith",
  additionalInfo: "Need access to internal tools",
});

// Check waitlist status
const status = await authClient.waitlist.checkStatus({
  email: "[email protected]"
});

// Admin operations (requires admin role)
const entries = await authClient.waitlist.list();
const entry = await authClient.waitlist.findOne({ id: "entry-id" });

// Approve/reject entries (admin only)
await authClient.waitlist.approve({ id: "entry-id" });
await authClient.waitlist.reject({ id: "entry-id" });

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | enabled | boolean | false | Enable/disable the waitlist | | allowedDomains | string[] | undefined | Restrict to specific email domains | | maximumWaitlistParticipants | number | undefined | Set capacity limits | | additionalFields | Record<string, FieldAttribute> | {} | Extend schema with custom fields | | autoApprove | boolean \| function | false | Auto-approve based on criteria | | validateEntry | function | undefined | Custom validation hooks | | onStatusChange | function | undefined | Status change callbacks | | disableSignInAndSignUp | boolean | false | Complete waitlist mode |

Additional Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | onJoinRequest | function | undefined | Callback when new requests are submitted | | canManageWaitlist | function | undefined | Custom function to check admin permissions | | rateLimit | object | undefined | Rate limiting configuration | | notifications | object | undefined | Notification settings |

API Endpoints

  • POST /api/auth/waitlist/join - Join the waitlist
  • GET /api/auth/waitlist/list - List waitlist entries (admin only)
  • GET /api/auth/waitlist/request/find - Find specific waitlist entry (admin only)
  • GET /api/auth/waitlist/request/check-status - Check waitlist status by email
  • POST /api/auth/waitlist/request/approve - Approve entry (admin only)
  • POST /api/auth/waitlist/request/reject - Reject entry (admin only)

Advanced Usage

Custom Validation

waitlist({
  enabled: true,
  validateEntry: async ({ email, additionalData }) => {
    // Custom business logic
    return email.includes("admin") || additionalData?.priority === "high";
  },
  onStatusChange: async (entry) => {
    // Send notification emails
    console.log(`Entry ${entry.id} status changed to ${entry.status}`);
  },
  onJoinRequest: async ({ request }) => {
    // Handle new join requests
    console.log(`New request from ${request.email}`);
  },
});

Schema Extension

waitlist({
  enabled: true,
  additionalFields: {
    department: {
      type: "string",
      required: true,
    },
    reason: {
      type: "string",
      required: false,
    },
  },
});

What's New in v3.0.0

🚀 Major Architectural Refactoring

  • 90% smaller main plugin file (from ~500 to ~200 lines)
  • Optimized bundle size - lightweight at ~22kB minified (~3.5kB gzipped)
  • Modular architecture with separated concerns
  • Self-contained - removed external dependencies (stoker removed)
  • Better TypeScript support with improved inference
  • Enhanced error handling with dedicated error codes
  • Improved testing with isolated components
  • Tree-shakable ESM modules for better bundling

New File Structure

  • error-codes.ts - HTTP status codes and error handling
  • client.ts - Simplified client plugin
  • schema.ts - Enhanced Zod schemas
  • types.ts - TypeScript type definitions

This refactor makes the plugin much more maintainable and follows established Better Auth plugin conventions.

Requirements

  • Better Auth ^1.3.4
  • Node.js 18+
  • TypeScript 5.0+

License

MIT

Acknowledgments

This plugin was inspired by the Better Auth Kit Waitlist Plugin and follows similar architectural patterns and conventions established by the Better Auth ecosystem.

Contributing

Issues and pull requests are welcome! Please ensure your contributions follow the existing code style and include appropriate tests.