Convex Invite-links

Add invite links and membership management to Convex apps with shareable URLs, email locking, expiration, and role-based access control.

Installation

npm install convex-invite-links

About 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

Benefits

Use cases

how to add team invite links to Convex app

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.

Convex membership management with roles

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.

expire and revoke invite links in Convex

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.

social preview for invite links Convex

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.

Frequently asked questions

Can I restrict invites to specific email addresses?

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.

How do I check if a user has access to a resource?

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.

Does this component handle invite URL generation automatically?

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.

Can I add users to groups without sending invites?

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.

How do I clean up old expired invites?

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.

Links