Better Auth for Payload CMS. One auth system for your admin panel and your app.
📖 Documentation · 📦 npm · 🤖 llms.txt
pnpm add payload-auth better-authimport { betterAuthPlugin } from 'payload-auth/better-auth'
export default buildConfig({
admin: { user: 'users' },
plugins: [
betterAuthPlugin({
users: { roles: ['user', 'admin'], adminRoles: ['admin'] },
betterAuthOptions: {
emailAndPassword: { enabled: true },
},
}),
],
})See the installation guide to get started.
| Path | Contents |
|---|---|
packages/payload-auth |
The published plugin and database adapter |
docs |
The documentation site (Fumadocs) |
demo |
A Next.js + Payload app exercising the plugin |
dev-docs |
Internal architecture, audit and test-plan notes |
plans |
Implementation plans |
pnpm install
pnpm build # build the plugin
pnpm dev # watch the plugin and run the demo
pnpm test # run the plugin test suite
pnpm test:run # single test runThe test suite needs Postgres. Start one with the bundled compose file:
docker compose -f docker-compose.test.yml up -dTo work on the documentation site:
pnpm --filter payload-auth-docs devSee CONTRIBUTING.md.
MIT