[PR #4814] [CLOSED] feat: add plugin Interface Enhancements for Payload CMS Integration #31191

Closed
opened 2026-04-17 22:06:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4814
Author: @nehaaprasad
Created: 9/22/2025
Status: Closed

Base: canaryHead: feat/payload-user-sync


📝 Commits (3)

  • 4b79b78 feat: Add plugin interface fields for Payload CMS integration
  • 3393166 feat: Implement plugin initialization and lifecycle management
  • 20feb97 Merge branch 'canary' into feat/payload-user-sync

📊 Changes

2 files changed (+60 additions, -7 deletions)

View changed files

📝 packages/better-auth/src/init.ts (+56 -3)
📝 packages/better-auth/src/types/plugins.ts (+4 -4)

📄 Description

PR Description:

  • This PR adds essential plugin interface improvements to support seamless Payload CMS user synchronization with Better Auth. The changes enable plugins to:

fixes: #4811

Key Features Added:

  • Plugin Dependencies: Plugins can now specify required dependencies using the requires field
  • Enhanced Database Hooks: Added delete hooks for all models (user, session, account, verification) with before/after functionality
  • Lifecycle Management: Introduced onInit hook for post-initialization setup and onDestroy for cleanup
  • Plugin-Level Database Hooks: Plugins can now provide their own database hooks that integrate with the global hook system

Benefits:

  • Enables Payload CMS to sync users from Better Auth as the single source of truth
  • Provides proper cleanup mechanisms for plugin resources
  • Supports conditional delete operations with hook validation
  • Maintains backward compatibility with existing plugins

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4814 **Author:** [@nehaaprasad](https://github.com/nehaaprasad) **Created:** 9/22/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/payload-user-sync` --- ### 📝 Commits (3) - [`4b79b78`](https://github.com/better-auth/better-auth/commit/4b79b785dc1a12c6d8b237be32d032fa15221aa6) feat: Add plugin interface fields for Payload CMS integration - [`3393166`](https://github.com/better-auth/better-auth/commit/3393166f21d553ca2fd05524b6721e33264381cf) feat: Implement plugin initialization and lifecycle management - [`20feb97`](https://github.com/better-auth/better-auth/commit/20feb97e25b7c72d11dc047a4180818f57ea6114) Merge branch 'canary' into feat/payload-user-sync ### 📊 Changes **2 files changed** (+60 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/init.ts` (+56 -3) 📝 `packages/better-auth/src/types/plugins.ts` (+4 -4) </details> ### 📄 Description ### PR Description: - This PR adds essential plugin interface improvements to support seamless Payload CMS user synchronization with Better Auth. The changes enable plugins to: fixes: #4811 **Key Features Added:** - **Plugin Dependencies**: Plugins can now specify required dependencies using the `requires` field - **Enhanced Database Hooks**: Added delete hooks for all models (user, session, account, verification) with before/after functionality - **Lifecycle Management**: Introduced `onInit` hook for post-initialization setup and `onDestroy` for cleanup - **Plugin-Level Database Hooks**: Plugins can now provide their own database hooks that integrate with the global hook system **Benefits:** - Enables Payload CMS to sync users from Better Auth as the single source of truth - Provides proper cleanup mechanisms for plugin resources - Supports conditional delete operations with hook validation - Maintains backward compatibility with existing plugins --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 22:06:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#31191