๐ฎ next-invite
A drop-in invite system for your Next.js app. Generate and share invite links for users to join your app.
Check out this example of a Next.js codebase showcasing an advanced implementation of next-invite
.
๐ง Under active development. Expect breaking changes until v1.0.0.
๐ก Install
npm install next-invite
yarn add next-invite
pnpm add next-invite
๐ Hello there! Follow me @linesofcode or visit linesofcode.dev for more cool projects like this one.
๐ Getting Started
๐งณ Storage
๐บ Upstash
โ๏ธ Drizzle
๐ DrizzlePgStore - Postgres
๐ง Constants
โ๏ธ zInvite
Constant |
Type |
zInvite |
ZodObject<{ id: ZodString; email: ZodNullable<ZodOptional<ZodString>>; code: ZodString; expires: ZodNullable<ZodOptional<ZodNumber>>; ... 7 more ...; uses: ZodNullable<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }> |
โ๏ธ zDeleteInviteArgs
Constant |
Type |
zDeleteInviteArgs |
ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id?: string; }, { id?: string; }> |
โ๏ธ zGetInviteArgs
Constant |
Type |
zGetInviteArgs |
ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id?: string; }, { id?: string; }> |
โ๏ธ zFindInviteArgs
Constant |
Type |
zFindInviteArgs |
ZodObject<{ email: ZodNullable<ZodOptional<ZodString>>; code: ZodString; }, "strip", ZodTypeAny, { email?: string; code?: string; }, { ...; }> |
โ๏ธ zCreateInviteArgs
Constant |
Type |
zCreateInviteArgs |
ZodObject<{ id: ZodNullable<ZodOptional<ZodString>>; email: ZodNullable<ZodOptional<ZodString>>; expires: ZodNullable<...>; data: ZodNullable<...>; unlimited: ZodOptional<...>; total: ZodNullable<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }> |
โ๏ธ zInvalidateInviteArgs
Constant |
Type |
zInvalidateInviteArgs |
ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id?: string; }, { id?: string; }> |
โ๏ธ zUseInviteArgs
Constant |
Type |
zUseInviteArgs |
ZodObject<{ code: ZodString; email: ZodNullable<ZodOptional<ZodString>>; data: ZodNullable<ZodOptional<ZodAny>>; }, "strip", ZodTypeAny, { ...; }, { ...; }> |
โ๏ธ zLogInviteUseArgs
Constant |
Type |
zLogInviteUseArgs |
ZodObject<{ id: ZodString; inviteId: ZodString; email: ZodNullable<ZodOptional<ZodString>>; data: ZodNullable<ZodOptional<ZodAny>>; }, "strip", ZodTypeAny, { ...; }, { ...; }> |
โ๏ธ zInviteLog
Constant |
Type |
zInviteLog |
ZodObject<{ id: ZodString; inviteId: ZodNullable<ZodOptional<ZodString>>; email: ZodNullable<ZodOptional<ZodString>>; data: ZodNullable<...>; createdAt: ZodUnion<...>; updatedAt: ZodUnion<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }> |
โ๏ธ zBaseFilterArgs
Constant |
Type |
zBaseFilterArgs |
ZodObject<{ limit: ZodNullable<ZodOptional<ZodNumber>>; offset: ZodNullable<ZodOptional<ZodNumber>>; all: ZodNullable<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }> |
โ๏ธ zFilterInvitesArgs
Constant |
Type |
zFilterInvitesArgs |
ZodObject<{ limit: ZodNullable<ZodOptional<ZodNumber>>; offset: ZodNullable<ZodOptional<ZodNumber>>; all: ZodNullable<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }> |
โ๏ธ zFilterInviteLogsArgs
Constant |
Type |
zFilterInviteLogsArgs |
ZodObject<{ limit: ZodNullable<ZodOptional<ZodNumber>>; offset: ZodNullable<ZodOptional<ZodNumber>>; all: ZodNullable<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }> |
โ๏ธ zDeleteInviteLogArgs
Constant |
Type |
zDeleteInviteLogArgs |
ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id?: string; }, { id?: string; }> |
โ๏ธ zGetInviteLogArgs
Constant |
Type |
zGetInviteLogArgs |
ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id?: string; }, { id?: string; }> |
๐ญ NextInvite
Methods
โ๏ธ createInvite
| Method | Type |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
| createInvite
| (args: any) => Promise<{ invite: { id?: string; email?: string; code?: string; expires?: number; data?: any; createdAt?: string or Date; updatedAt?: string | Date; invalid?: boolean; unlimited?: boolean; total?: number; remaining?: number; uses?: number; }; }>
|
โ๏ธ createInvite
Method |
Type |
createInvite |
(args?: { id?: string; email?: string; expires?: number; data?: any; unlimited?: boolean; total?: number; }) => Promise<{ invite: { id?: string; email?: string; code?: string; expires?: number; data?: any; createdAt?: string or Date; ... 5 more ...; uses?: number; }; }> |
โ๏ธ invalidateInvite
| Method | Type |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| invalidateInvite
| (args: { id?: string; }) => Promise<{ invite: { id?: string; email?: string; code?: string; expires?: number; data?: any; createdAt?: string or Date; updatedAt?: string | Date; invalid?: boolean; unlimited?: boolean; total?: number; remaining?: number; uses?: number; }; }>
|
โ๏ธ filterInvites
Method |
Type |
filterInvites |
(args?: { limit?: number; offset?: number; all?: boolean; }) => Promise<{ invites: { count: number; results: { id?: string; email?: string; code?: string; expires?: number; data?: any; createdAt?: string or Date; ... 5 more ...; uses?: number; }[]; }; }> |
โ๏ธ filterInviteLogs
| Method | Type |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| filterInviteLogs
| (args?: { limit?: number; offset?: number; all?: boolean; }) => Promise<{ inviteLogs: { count: number; results: { id?: string; inviteId?: string; email?: string; data?: any; createdAt?: string or Date; updatedAt?: string | Date; }[]; }; }>
|
โ๏ธ findInvite
| Method | Type |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| findInvite
| (args: { email?: string; code?: string; }) => Promise<{ invite: { id?: string; email?: string; code?: string; expires?: number; data?: any; createdAt?: string or Date; updatedAt?: string | Date; invalid?: boolean; unlimited?: boolean; total?: number; remaining?: number; uses?: number; }; }>
|
โ๏ธ getInvite
| Method | Type |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| getInvite
| (args: { id?: string; }) => Promise<{ invite: { id?: string; email?: string; code?: string; expires?: number; data?: any; createdAt?: string or Date; updatedAt?: string | Date; invalid?: boolean; unlimited?: boolean; total?: number; remaining?: number; uses?: number; }; }>
|
โ๏ธ deleteInvite
Method |
Type |
deleteInvite |
(args: { id?: string; }) => Promise<boolean> |
โ๏ธ getInviteLog
| Method | Type |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| getInviteLog
| (args: { id?: string; }) => Promise<{ inviteLog: { id?: string; inviteId?: string; email?: string; data?: any; createdAt?: string or Date; updatedAt?: string | Date; }; }>
|
โ๏ธ deleteInviteLog
Method |
Type |
deleteInviteLog |
(args: { id?: string; }) => Promise<boolean> |
โ๏ธ isValidInviteById
Method |
Type |
isValidInviteById |
(args: { id?: string; }) => Promise<boolean> |
โ๏ธ isValidInviteByCode
Method |
Type |
isValidInviteByCode |
(args: { email?: string; code?: string; }) => Promise<boolean> |
โ๏ธ useInvite
| Method | Type |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| useInvite
| (args: { code?: string; email?: string; data?: any; }) => Promise<{ invite: { id?: string; email?: string; code?: string; expires?: number; data?: any; createdAt?: string or Date; updatedAt?: string | Date; ... 4 more ...; uses?: number; }; inviteLog?: { ...; }; }>
|