Add invite links and membership management to Convex apps with shareable URLs, email locking, expiration, and role-based access control.
npm install convex-invite-links**Invite links and membership management as a drop-in Convex component.**
Handle the full invite-to-member lifecycle without building it from scratch.
- Shareable invite links with configurable expiration and usage limits
- Email-locked invites for controlled access
- Group and resource-level membership management
- Role-based access control per group
- Automatic cleanup of expired invites via crons
Use convex-invite-links to create shareable team invite URLs with makeInvite() and handle acceptance with claimInvite(). The component automatically manages membership tracking, email verification, and access granting when users click invite links.
The convex-invite-links component provides isMember(), hasAccess(), and role-based group management. Create invites with metadata for roles, then use getAllGroups() and getAllMembers() to query membership across your app.
Set expiration times when creating invites with makeInvite(), then use revokeInvite() to manually invalidate specific invites. Schedule deleteOldInvites() in Convex cron jobs to automatically clean up expired invites.
Use the handleInviteWebhook HTTP handler to serve invite pages with og:title and og:description metadata. When users share invite URLs, social platforms will display custom preview cards with your app name and invite details.
Yes, convex-invite-links supports email-locked invites. When creating an invite with makeInvite(), pass an email parameter to restrict claiming to that specific email address. The claimInvite() function will validate the email match before granting access.
Use the hasAccess() query function from convex-invite-links to check resource-level permissions, or isMember() to verify group membership. Both functions take a userId and return boolean results for authorization checks in your Convex queries and mutations.
The convex-invite-links component provides makeInviteUrl() to generate shareable URLs from invite tokens, and inviteFromUrl() to parse tokens from incoming requests. You configure the base URL during initialization and the component handles token generation and parsing.
Yes, convex-invite-links includes direct membership management with addMember() and grantAccess() functions. These bypass the invite process and immediately add users to groups or grant resource access, useful for admin actions or programmatic membership changes.
Use the deleteOldInvites() mutation from convex-invite-links in a scheduled Convex cron job. Pass an olderThanMs parameter to specify the age threshold, and the component will remove expired, claimed, and revoked invites older than the specified time period.