Wraps the Better Auth library for Payload CMS 3. It generates Payload collections from your Better Auth options, mounts the auth API endpoints and provides a Payload database adapter for Better Auth. Requires the better-auth and better-auth-harmony peer dependencies and Payload 3.
A Payload CMS 3 plugin for Better Auth
Installation
npm i @b3nab/payload-better-auth74
Stars
3
Forks
1
Open Issues
4 months ago
Last Updated
0
Weekly Downloads
v
npm Version
Dependencies
74+1 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 74 |
| Dec 5, 2026 | 74 |
| Dec 4, 2026 | 74 |
| Dec 3, 2026 | 74 |
| Dec 2, 2026 | 74 |
| Dec 1, 2026 | 74 |
| Nov 30, 2026 | 74 |
| Nov 29, 2026 | 74 |
| Nov 28, 2026 | 74 |
| Nov 27, 2026 | 74 |
| Nov 26, 2026 | 74 |
| Nov 25, 2026 | 74 |
| Nov 24, 2026 | 74 |
| Nov 23, 2026 | 74 |
| Nov 22, 2026 | 74 |
| Nov 21, 2026 | 74 |
| Nov 20, 2026 | 74 |
| Nov 19, 2026 | 74 |
| Nov 18, 2026 | 74 |
| Nov 17, 2026 | 74 |
| Nov 16, 2026 | 74 |
| Nov 15, 2026 | 74 |
| Nov 14, 2026 | 74 |
| Nov 13, 2026 | 74 |
| Nov 12, 2026 | 74 |
| Nov 11, 2026 | 74 |
| Nov 10, 2026 | 74 |
| Nov 9, 2026 | 74 |
| Nov 8, 2026 | 74 |
| Nov 7, 2026 | 74 |
| Nov 6, 2026 | 74 |
| Nov 5, 2026 | 74 |
| Nov 4, 2026 | 74 |
| Nov 3, 2026 | 74 |
| Nov 2, 2026 | 74 |
| Nov 1, 2026 | 74 |
| Oct 31, 2026 | 74 |
| Oct 30, 2026 | 74 |
| Oct 29, 2026 | 74 |
| Oct 28, 2026 | 74 |
| Oct 27, 2026 | 74 |
| Oct 26, 2026 | 74 |
| Oct 25, 2026 | 74 |
| Oct 24, 2026 | 74 |
| Oct 23, 2026 | 74 |
| Oct 22, 2026 | 74 |
| Oct 21, 2026 | 74 |
| Oct 20, 2026 | 74 |
| Oct 19, 2026 | 74 |
| Oct 18, 2026 | 74 |
| Oct 17, 2026 | 74 |
| Oct 16, 2026 | 74 |
| Oct 15, 2026 | 74 |
| Oct 14, 2026 | 74 |
| Oct 13, 2026 | 74 |
| Oct 12, 2026 | 74 |
| Oct 11, 2026 | 74 |
| Oct 10, 2026 | 74 |
| Oct 9, 2026 | 74 |
| Oct 8, 2026 | 74 |
| Oct 7, 2026 | 74 |
| Oct 6, 2026 | 74 |
| Oct 5, 2026 | 74 |
| Oct 4, 2026 | 74 |
| Oct 3, 2026 | 74 |
| Oct 2, 2026 | 74 |
| Oct 1, 2026 | 74 |
| Sep 30, 2026 | 74 |
| Sep 29, 2026 | 74 |
| Sep 28, 2026 | 73 |
| Sep 27, 2026 | 73 |
| Sep 26, 2026 | 73 |
| Sep 25, 2026 | 73 |
| Sep 24, 2026 | 73 |
| Sep 23, 2026 | 73 |
| Sep 22, 2026 | 73 |
| Sep 21, 2026 | 73 |
| Sep 20, 2026 | 73 |
| Sep 19, 2026 | 73 |
| Sep 18, 2026 | 73 |
| Sep 17, 2026 | 73 |
| Sep 16, 2026 | 73 |
| Sep 15, 2026 | 73 |
| Sep 14, 2026 | 73 |
| Sep 13, 2026 | 73 |
| Sep 12, 2026 | 73 |
| Sep 11, 2026 | 73 |
| Sep 10, 2026 | 73 |
| Sep 9, 2026 | 73 |
| Sep 8, 2026 | 73 |
| Sep 7, 2026 | 73 |
Trends appear after 7 days of data. Daily snapshots have not started yet.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/931756401-payload-better-auth)<a href="https://payloaddirectory.dev/plugins/931756401-payload-better-auth"><img src="https://payloaddirectory.dev/badge/931756401-payload-better-auth.svg" alt="Payload Directory"></a>README
A plugin that integrates Better Auth with Payload CMS v3, providing enhanced authentication capabilities. Built to be used in production, with real users, so to be rock solid. ๐ฟ
This plugin is a wrapper around the better-auth library. It provides a better-way ๐ค to manage authentication for Payload CMS v3.
The goal is to seamlessly integrate better-auth in your Payload CMS v3 application, providing a robust and feature-rich authentication system with a focus on user experience and developer productivity.
While Payload CMS comes with a solid and extensible authentication system out of the box, it primarily focuses on basic email/password authentication and API keys. This serves many use cases well, but modern applications often require more sophisticated authentication methods and features.
/api/auth/*payload.betterAuth instance, fully typed with your own plugin optionsadmin and user roles out of the boxThis project is licensed under the GNU Affero General Public License v3.0. For commercial licensing options, please contact the maintainer.
Install the plugin and its peer dependencies:
pnpm add @b3nab/payload-better-auth better-auth better-auth-harmony
Create the plugin config in its own file:
// lib/payload-better-auth.config.ts
import { defineBetterAuthPluginOptions } from '@b3nab/payload-better-auth'
export const payloadBetterAuthConfig = defineBetterAuthPluginOptions({
// Better Auth Config. https://www.better-auth.com/docs/reference/options
betterAuth: {
// used by two factor plugin as an issuer and other things
appName: 'My App',
// better-auth secret - you can omit it if your env variable is named `BETTER_AUTH_SECRET`
/** you can generate a good secret
* using the following command:
* @example
* openssl rand -base64 32
*/
secret: process.env.BETTER_AUTH_SECRET,
},
})
// makes payload.betterAuth fully typed with YOUR options, everywhere
declare module '@b3nab/payload-better-auth' {
interface PayloadBetterAuthRegister {
pluginOptions: typeof payloadBetterAuthConfig
}
}
Then add the plugin to your payload.config.ts file:
import { buildConfig } from 'payload'
import { betterAuthPlugin } from '@b3nab/payload-better-auth'
import { payloadBetterAuthConfig } from './lib/payload-better-auth.config'
export default buildConfig({
// ... other config
plugins: [
betterAuthPlugin(payloadBetterAuthConfig),
// ... other plugins
],
})
See the documentation for the full setup: custom collections, roles, social providers, email flows, and protected Next.js routes.
git checkout -b feature/amazing-feature)git commit -m 'feat: add some amazing feature')git push origin feature/amazing-feature)Created by Benedetto Abbenanti
payload auth
Replace Payload's built-in auth with Better Auth for a shared admin and frontend session
7021.0k/wk349v3
payload better auth
Replace Payload's built-in auth with Better Auth, including admin email OTP and session-based req.user
301v3
payload better auth
Better Auth database adapter and plugins that run authentication through Payload collections
9011.9k/wk77v3 v4
payload authjs
Sign in to Payload CMS through Auth.js 5 providers and use the Auth.js session as the Payload user
903.1k/wk206v3
payload totp
Add TOTP-based two-factor authentication to a Payload auth collection using authenticator apps
8425.1k/wk168v3
payload zitadel plugin
Log in to the Mzinga admin through Zitadel or another OIDC provider using authorization code with PKCE
72608/wk11v?