Invitations
Learn about the invitation system for managing workspace members and collaboration.
The invitation system provides a secure way to add new members to workspaces with specific roles and permissions.
Invitation Schema
Database Definition
The invitation system uses a PostgreSQL table with the following structure:
Invitation Flow
The invitation process is designed to be secure, trackable, and user-friendly for both administrators and invitees.
1. Send Invitation
Workspace admin sends invitation with specified role
2. Email Delivery
3. Accept Invitation
Recipient accepts via email link before expiration
4. Member Creation
New workspace member created with assigned role
Key Features
Security
Role Assignment
Cascade Deletion
🗑️ Automatic cleanup with workspace deletion
Status Tracking
📊 Monitor pending and expired invitations
Invitation States
Invitations can exist in multiple states throughout their lifecycle. Understanding these states is key to managing the invitation process.
Pending
Invitation sent but not yet accepted:
Accepted
Successfully accepted invitation:
Expired
Invitation past expiration date:
Completed
Member added to workspace:
Invitations automatically expire after the specified duration. Expired invitations cannot be accepted and require a new invitation to be sent.
Implementation
Creating Invitations
Send invitations to new workspace members:
Listing Invitations
View all pending invitations for a workspace:
Resending Invitations
Resend an expired or pending invitation:
Revoking Invitations
Cancel a pending invitation:
Accepting Invitations
Invitation Link
The invitation email contains a secure link with the following format:
Acceptance Page
Create a dedicated page for accepting invitations:
Server Action for Accepting
Create a server action to process the invitation acceptance:
Best Practices
Security
- Generate cryptographically secure tokens
- Set reasonable expiration times (24-72 hours)
- Validate email ownership before accepting
- Use HTTPS for all invitation links
User Experience
- Send clear, branded invitation emails
- Include information about who sent the invitation
- Allow resending of expired invitations
- Provide clear status updates for pending invitations
Implementation
- Use database transactions for invitation acceptance
- Implement rate limiting for invitation sending
- Add domain restrictions for enterprise workspaces
- Provide bulk invitation options for large teams
Additional Resources
Multi-Workspace Management
See the Multi-Workspace documentation for more information on workspace management.
Email Service
Refer to the Email Service documentation for details on sending invitation emails.