payload-auth swaps Payload's built-in authentication for Better Auth, so the admin panel and your frontend share one session and one user table. It installs a database adapter that uses Payload's Local API and generates collections from the Better Auth schema. Requires Payload 3.79.1 or newer, Better Auth 1.5 or newer, and Next.js.
The most powerful authentication solution for Payload CMS
Installation
npm i payload-auth349
Stars
57
Forks
31
Open Issues
4 months ago
Last Updated
21.0k
Weekly Downloads
v3.0.0
npm Version
1.6 MB
Unpacked Size
7
Dependencies
349+20 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 349 |
| Dec 4, 2026 | 350 |
| Dec 3, 2026 | 350 |
| Dec 2, 2026 | 350 |
| Dec 1, 2026 | 349 |
| Nov 30, 2026 | 349 |
| Nov 29, 2026 | 349 |
| Nov 28, 2026 | 349 |
| Nov 27, 2026 | 349 |
| Nov 26, 2026 | 349 |
| Nov 25, 2026 | 349 |
| Nov 24, 2026 | 349 |
| Nov 23, 2026 | 349 |
| Nov 22, 2026 | 348 |
| Nov 21, 2026 | 348 |
| Nov 20, 2026 | 348 |
| Nov 19, 2026 | 348 |
| Nov 18, 2026 | 347 |
| Nov 17, 2026 | 346 |
| Nov 16, 2026 | 346 |
| Nov 15, 2026 | 346 |
| Nov 14, 2026 | 346 |
| Nov 13, 2026 | 346 |
| Nov 12, 2026 | 345 |
| Nov 11, 2026 | 345 |
| Nov 10, 2026 | 345 |
| Nov 9, 2026 | 345 |
| Nov 8, 2026 | 345 |
| Nov 7, 2026 | 345 |
| Nov 6, 2026 | 346 |
| Nov 5, 2026 | 346 |
| Nov 4, 2026 | 346 |
| Nov 3, 2026 | 347 |
| Nov 2, 2026 | 347 |
| Nov 1, 2026 | 347 |
| Oct 31, 2026 | 346 |
| Oct 30, 2026 | 346 |
| Oct 29, 2026 | 345 |
| Oct 28, 2026 | 345 |
| Oct 27, 2026 | 344 |
| Oct 26, 2026 | 344 |
| Oct 25, 2026 | 344 |
| Oct 24, 2026 | 344 |
| Oct 23, 2026 | 344 |
| Oct 22, 2026 | 344 |
| Oct 21, 2026 | 340 |
| Oct 20, 2026 | 340 |
| Oct 19, 2026 | 340 |
| Oct 18, 2026 | 339 |
| Oct 17, 2026 | 337 |
| Oct 16, 2026 | 337 |
| Oct 15, 2026 | 337 |
| Oct 14, 2026 | 337 |
| Oct 13, 2026 | 337 |
| Oct 12, 2026 | 337 |
| Oct 11, 2026 | 336 |
| Oct 10, 2026 | 336 |
| Oct 9, 2026 | 335 |
| Oct 8, 2026 | 335 |
| Oct 7, 2026 | 335 |
| Oct 6, 2026 | 335 |
| Oct 5, 2026 | 335 |
| Oct 4, 2026 | 335 |
| Oct 3, 2026 | 334 |
| Oct 2, 2026 | 334 |
| Oct 1, 2026 | 334 |
| Sep 30, 2026 | 333 |
| Sep 29, 2026 | 333 |
| Sep 28, 2026 | 331 |
| Sep 27, 2026 | 331 |
| Sep 26, 2026 | 331 |
| Sep 25, 2026 | 331 |
| Sep 24, 2026 | 331 |
| Sep 23, 2026 | 331 |
| Sep 22, 2026 | 331 |
| Sep 21, 2026 | 329 |
| Sep 20, 2026 | 329 |
| Sep 19, 2026 | 329 |
| Sep 18, 2026 | 329 |
| Sep 17, 2026 | 329 |
| Sep 16, 2026 | 329 |
| Sep 15, 2026 | 329 |
| Sep 14, 2026 | 329 |
| Sep 13, 2026 | 329 |
| Sep 12, 2026 | 329 |
| Sep 11, 2026 | 329 |
| Sep 10, 2026 | 329 |
| Sep 9, 2026 | 329 |
| Sep 8, 2026 | 329 |
| Sep 7, 2026 | 329 |
| Sep 6, 2026 | 329 |
23.9K+16K since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 23,872 |
| Dec 4, 2026 | 23,034 |
| Dec 3, 2026 | 21,928 |
| Dec 2, 2026 | 22,578 |
| Dec 1, 2026 | 24,407 |
| Nov 30, 2026 | 23,302 |
| Nov 29, 2026 | 21,181 |
| Nov 28, 2026 | 19,932 |
| Nov 27, 2026 | 19,183 |
| Nov 26, 2026 | 19,307 |
| Nov 25, 2026 | 19,850 |
| Nov 24, 2026 | 17,591 |
| Nov 23, 2026 | 17,529 |
| Nov 22, 2026 | 18,294 |
| Nov 21, 2026 | 19,238 |
| Nov 20, 2026 | 20,473 |
| Nov 19, 2026 | 20,079 |
| Nov 18, 2026 | 18,205 |
| Nov 17, 2026 | 17,396 |
| Nov 16, 2026 | 17,283 |
| Nov 15, 2026 | 17,137 |
| Nov 14, 2026 | 16,358 |
| Nov 13, 2026 | 16,279 |
| Nov 12, 2026 | 16,323 |
| Nov 11, 2026 | 15,809 |
| Nov 10, 2026 | 15,445 |
| Nov 9, 2026 | 15,441 |
| Nov 8, 2026 | 15,092 |
| Nov 7, 2026 | 14,553 |
| Nov 6, 2026 | 13,936 |
| Nov 5, 2026 | 13,503 |
| Nov 4, 2026 | 13,000 |
| Nov 3, 2026 | 12,516 |
| Nov 2, 2026 | 11,970 |
| Nov 1, 2026 | 10,962 |
| Oct 31, 2026 | 10,774 |
| Oct 30, 2026 | 9,381 |
| Oct 29, 2026 | 7,200 |
| Oct 28, 2026 | 5,586 |
| Oct 27, 2026 | 5,656 |
| Oct 26, 2026 | 5,657 |
| Oct 25, 2026 | 5,939 |
| Oct 24, 2026 | 5,657 |
| Oct 23, 2026 | 4,400 |
| Oct 22, 2026 | 6,076 |
| Oct 21, 2026 | 7,748 |
| Oct 20, 2026 | 7,910 |
| Oct 19, 2026 | 7,791 |
| Oct 18, 2026 | 7,575 |
| Oct 17, 2026 | 7,340 |
| Oct 16, 2026 | 8,552 |
| Oct 15, 2026 | 8,226 |
| Oct 14, 2026 | 8,009 |
| Oct 13, 2026 | 8,018 |
| Oct 12, 2026 | 8,615 |
| Oct 11, 2026 | 8,271 |
| Oct 10, 2026 | 8,805 |
| Oct 9, 2026 | 9,078 |
| Oct 8, 2026 | 9,061 |
| Oct 7, 2026 | 8,748 |
| Oct 6, 2026 | 8,772 |
| Oct 5, 2026 | 8,120 |
| Oct 4, 2026 | 8,782 |
| Oct 3, 2026 | 8,489 |
| Oct 2, 2026 | 8,114 |
| Oct 1, 2026 | 7,845 |
| Sep 30, 2026 | 7,995 |
| Sep 29, 2026 | 7,720 |
| Sep 28, 2026 | 7,719 |
| Sep 27, 2026 | 6,874 |
| Sep 26, 2026 | 7,027 |
| Sep 25, 2026 | 8,232 |
| Sep 24, 2026 | 9,208 |
| Sep 23, 2026 | 9,418 |
| Sep 22, 2026 | 9,695 |
| Sep 21, 2026 | 9,683 |
| Sep 20, 2026 | 15,240 |
| Sep 19, 2026 | 17,163 |
| Sep 18, 2026 | 16,208 |
| Sep 17, 2026 | 15,527 |
| Sep 16, 2026 | 15,069 |
| Sep 15, 2026 | 15,911 |
| Sep 14, 2026 | 16,436 |
| Sep 13, 2026 | 11,073 |
| Sep 12, 2026 | 8,658 |
| Sep 11, 2026 | 8,834 |
| Sep 10, 2026 | 8,523 |
| Sep 9, 2026 | 8,293 |
| Sep 8, 2026 | 7,397 |
| Sep 7, 2026 | 7,534 |
| Sep 6, 2026 | 7,910 |
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/944322391-payload-auth)<a href="https://payloaddirectory.dev/plugins/944322391-payload-auth"><img src="https://payloaddirectory.dev/badge/944322391-payload-auth.svg" alt="Payload Directory"></a>README
Better Auth for Payload CMS. One auth system for your admin panel and your app.
payload-auth replaces Payload's built-in authentication with Better Auth. The Payload admin panel and your frontend share the same session, so a user who signs in with Google on your marketing site is the same user Payload sees in the admin panel โ no second user table, no bridging code.
๐ Documentation ยท ๐ค llms.txt
pnpm add payload-auth better-auth
// src/payload.config.ts
import { buildConfig } from 'payload'
import { betterAuthPlugin } from 'payload-auth/better-auth'
export default buildConfig({
admin: { user: 'users' },
plugins: [
betterAuthPlugin({
users: {
roles: ['user', 'admin'],
adminRoles: ['admin'],
},
betterAuthOptions: {
emailAndPassword: { enabled: true },
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
},
},
},
}),
],
})
// src/app/api/auth/[...all]/route.ts
import configPromise from '@payload-config'
import { toNextJsHandler } from 'better-auth/next-js'
import { getPayloadAuth } from 'payload-auth/better-auth'
const payload = await getPayloadAuth(configPromise)
export const { POST, GET } = toNextJsHandler(payload.betterAuth)
Then regenerate the import map and create the schema:
pnpm payload generate:importmap
pnpm payload migrate:create && pnpm payload migrate
See the installation guide for the full walkthrough.
users, sessions, accounts and verifications are built from the Better Auth schema, plus one collection for every Better Auth plugin you enable โ passkeys, two-factors, organizations, API keys, SSO providers and more.admin plugin.| Import path | Contents |
|---|---|
payload-auth/better-auth | Plugin, adapter and types โ the usual import |
payload-auth/better-auth/plugin | Plugin only |
payload-auth/better-auth/adapter | Adapter only |
payload-auth/better-auth/plugin/client | Client components |
payload-auth/better-auth/plugin/rsc | Server components and admin views |
payload-auth/shared/payload/fields | Reusable Payload field components |
| Requirement | Version |
|---|---|
payload, @payloadcms/next, @payloadcms/ui | >=3.79.1 <4 |
better-auth, @better-auth/core | >=1.5.0 <2 |
next | >=15.4.8 <17 |
react, react-dom | >=19.2.1 <20 |
zod | ^4.3.6 |
Any Payload database adapter works โ the plugin talks to Payload's Local API, not to your database directly.
| Installation | Install and wire up the plugin |
| How it works | The architecture |
| Collections | What gets generated, and how to extend it |
| Plugin options | Every option, with defaults |
| Better Auth plugin support | What is configured automatically |
| Troubleshooting | Common problems |
MIT
Topics
payload better auth
Better Auth database adapter and plugins that run authentication through Payload collections
9011.9k/wk77v3 v4
payload better auth
Integrate Better Auth into Payload CMS 3 with generated collections, API endpoints and admin login
3474v3
payload better auth
Replace Payload's built-in auth with Better Auth, including admin email OTP and session-based req.user
301v3
payload zitadel plugin
Log in to the Mzinga admin through Zitadel or another OIDC provider using authorization code with PKCE
72608/wk11v?
payload passkey
Passkey login and management for the Payload admin panel, built on Better Auth
66490/wk1v3 v4
oidc
OpenID Connect single sign-on for Payload using Authorization Code Flow with PKCE and native Payload sessions
65745/wk0v3