0.4 Release

Better Auth Invite Plugin 0.4 introduces permissions-based invite authorization, full reject and cancel flows, lifecycle hooks, and a new adapter architecture for greater flexibility and control.

0-Sandy avatarSandyβ€’

0.4 Release

Package Renamed

This article refers to version 0.4, when the package was still named better-auth-invite-plugin.
Starting from version 0.5, it has been renamed to better-invite.

We're excited to announce the release of Better Auth Invite Plugin 0.4. This is a major step forward for flexibility, control, and extensibility in your invite flows.

To upgrade run:

npm install better-auth-invite-plugin@0.4

Then update your database schema by running one of the following commands:

npx @better-auth/cli migrate
npx @better-auth/cli generate

πŸš€ Highlights

Full reject invite flow

Invitations can now be rejected via:

  • POST /invite/reject
  • canRejectInvite option (default: true)
  • beforeRejectInvite and afterRejectInvite hooks
  • CANT_REJECT_INVITE error code

This gives you complete control over how rejections are handled, logged, or audited.

πŸ‘‰ See the api of reject invite


Cancel invite support

You can now cancel pending invitations with:

  • canCancelInvite
  • beforeCancelInvite and afterCancelInvite hooks
  • Full route and test coverage for the cancel flow

This is especially useful for admin panels or moderation tools where invites may need to be revoked.

πŸ‘‰ See the api of cancel invite


Get invite

A dedicated route for retrieving invite information has been added, making it easier to build custom UIs around invitation state.

πŸ‘‰ See the api of get invite


New adapter architecture

0.4 introduces getInviteAdapter, centralizing invite and invite usage database logic.

This refactor:

  • Simplifies internal architecture
  • Makes database integrations cleaner
  • Improves long-term extensibility

Routes, hooks, and utilities now rely on this adapter layer for better separation of concerns.


✨ More features

Lifecycle hooks across the invite flow

You now have access to:

  • beforeCreateInvite
  • afterCreateInvite
  • beforeAcceptInvite
  • afterAcceptInvite
  • beforeRejectInvite
  • afterRejectInvite
  • beforeCancelInvite
  • afterCancelInvite

Hooks are standardized to receive a single object argument, improving consistency and type safety.

This makes it easier to:

  • Trigger side effects
  • Send analytics events
  • Add logging
  • Integrate with external services

Internal improvements

  • Routes refactored from src/routes.ts into src/routes/*
  • Renamed internal references from invite to invitation for clarity
  • Improved type definitions
  • Expanded test coverage across new flows

πŸ› Bug fixes & Improvements

  • Fixed test issues and improved reliability
  • Ensured async support for:
    • canCreateInvite
    • canAcceptInvite
    • sendUserInvitation
  • Verified hook execution order and arguments via tests
  • Fixed lefthook error
  • General internal refactors for stability and maintainability

Version 0.4 significantly expands what you can build with the Invite Pluginβ€”while keeping the API clean and predictable.

As always, feedback and contributions are welcome :)

Check the full changelog