I’m building a project using Next.js + Supabase (Auth + DB) + Server Actions and want to implement a user-to-user invitation flow.
Use case:
A logged-in user (Manager) should be able to invite another user (Investor) to a specific Property.
Current thinking:
Manager submits invite (email, role = investor, property_id, metadata). (Multiple invites)
Store invite in an invitations table for tracking (status: pending/accepted/expired).
Send email with invite link.
Invite link redirects to invite accept page to prefilled sign-up page.
After successful sign-up:
Assign role = investor
Attach them to the correct property_id
Mark invite as accepted.
Invite page flow :
New user → sign up → assign role + property → mark accepted → notify manager → wait for manager approval
Existing user → login → one-click accept → notify manager → wait for approval
Edge cases:
Prevent inviting existing investor to that property
Prevent manager inviting manager as investor
Handle duplicate invites safely