Goal
Build the backend invite system that supports inviting users to both organizations and projects via email.
Depends on: #44
Scope
Database
- Create an
invites table with: type (organization/project), target entity ID, inviter admin ID, invitee email, token, status (pending/accepted/revoked/expired), assigned role, expiry timestamp.
- Write migration for the new table.
API Endpoints
- Create invite — send an org or project invite to an email address with a specified role.
- List invites — list pending/accepted invites for an organization or project.
- Accept invite — accept a pending invite (adds user to org/project, marks invite as accepted). If a user is invited to a project in an org they're not part of, auto-add them to the org.
- Revoke invite — cancel a pending invite.
- Check pending invites — endpoint for the frontend to check if the current user has pending invites on sign-in.
System Email
- Set up transactional/system email sending capability (currently the platform only sends campaign emails to end-users via WASM providers).
- Create an invite email template with a token link.
Auth Integration
- Handle the case where an invited user doesn't have an account yet (invite link → Clerk sign-up → auto-accept on first login).
- Handle the case where an existing user is invited (show pending invite on sign-in).
Goal
Build the backend invite system that supports inviting users to both organizations and projects via email.
Depends on: #44
Scope
Database
invitestable with: type (organization/project), target entity ID, inviter admin ID, invitee email, token, status (pending/accepted/revoked/expired), assigned role, expiry timestamp.API Endpoints
System Email
Auth Integration