The `better-auth-waitlist` package, currently at version 3.0.1, is a lightweight and production-ready plugin designed to integrate comprehensive waitlist management into the Better Auth authentication system. It offers features such as administrative approval workflows, restrictions based on email domains, and highly customizable validation for waitlist entries. The package is optimized for minimal bundle size, weighing approximately ~22 kB minified and ~3.5 kB gzipped, and lists `zod` as its only direct runtime dependency. Shipping exclusively as an ES module (ESM), it mandates a Node.js environment of version 18 or higher. Its primary differentiators include deep integration with Better Auth, flexible configuration options for various waitlist use cases (e.g., capacity limits, auto-approval, custom data fields), and client-side utilities for seamless application integration, supporting operations like joining, status checks, and admin-only actions such as listing, finding, approving, and rejecting entries.
npm install better-auth-waitlistVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure the `better-auth-waitlist` plugin for both server-side Better Auth initialization and client-side application integration. It includes examples of defining custom fields and auto-approval logic for the server plugin, setting up the client with a base URL, and performing common waitlist operations such as joining and checking entry status. It also highlights the crucial step of running database migrations.
Migrate your project to use ES module import syntax (`import ... from '...'`) for all imports from this package. If your project is a Node.js application, ensure your `package.json` includes `'type': 'module'` or use `.mjs` file extensions.
Upgrade your Node.js runtime environment to version 18 or greater to ensure compatibility and access to necessary features.
After installing and configuring the plugin, execute the database migration command: `npx @better-auth/cli migrate`.
Ensure your Better Auth implementation correctly assigns and validates admin roles for users managing the waitlist. You may need to implement a custom `canManageWaitlist` function in the plugin configuration for specific authorization logic.
Set the `NEXT_PUBLIC_AUTH_URL` environment variable (or the equivalent for your framework, such as `VITE_AUTH_URL` or `REACT_APP_AUTH_URL`) to the correct URL of your Better Auth API endpoint.
Refactor your imports to use ES module syntax: `import { waitlist } from 'better-auth-waitlist';`.Ensure `waitlistClient()` is included in the `plugins` array when calling `createAuthClient`: `plugins: [waitlistClient()]`.
Run the database migration command from your project root: `npx @better-auth/cli migrate`.
Ensure that environment variables like `NEXT_PUBLIC_AUTH_URL` are correctly accessed and bundled for client-side code by your framework's build process, often requiring specific syntax like `import.meta.env` or framework-specific conventions.