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.4Then update your database schema by running one of the following commands:
npx @better-auth/cli migratenpx @better-auth/cli generateπ Highlights
Full reject invite flow
Invitations can now be rejected via:
POST /invite/rejectcanRejectInviteoption (default:true)beforeRejectInviteandafterRejectInvitehooksCANT_REJECT_INVITEerror 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:
canCancelInvitebeforeCancelInviteandafterCancelInvitehooks- 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:
beforeCreateInviteafterCreateInvitebeforeAcceptInviteafterAcceptInvitebeforeRejectInviteafterRejectInvitebeforeCancelInviteafterCancelInvite
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.tsintosrc/routes/* - Renamed internal references from
invitetoinvitationfor clarity - Improved type definitions
- Expanded test coverage across new flows
π Bug fixes & Improvements
- Fixed test issues and improved reliability
- Ensured async support for:
canCreateInvitecanAcceptInvitesendUserInvitation
- 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 :)