Skip to content

Repository files navigation

payload-auth

Better Auth for Payload CMS. One auth system for your admin panel and your app.

📖 Documentation · 📦 npm · 🤖 llms.txt

pnpm add payload-auth better-auth
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 },
      },
    }),
  ],
})

See the installation guide to get started.

Repository layout

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

Development

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 run

The test suite needs Postgres. Start one with the bundled compose file:

docker compose -f docker-compose.test.yml up -d

To work on the documentation site:

pnpm --filter payload-auth-docs dev

See CONTRIBUTING.md.

License

MIT

About

Robust Payload CMS plugin to integrate Better-Auth into your projects

Topics

Resources

Contributing

Stars

325 stars

Watchers

15 watching

Forks

Releases

Packages

Used by

Contributors

Languages