Project Invitation API Router (project/invitation.ts)

onlook · integration, Integration / API, invitation, api, trpc, email, auth

tRPC router exposing endpoints to create, retrieve, and manage project invitation links, including validation and email sending.

// Source: https://github.com/mperkins0155/onlook | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { env } from '@/env';
import {
    authUsers,
    createDefaultUserCanvas,
    projectInvitationInsertSchema,
    projectInvitations,
    fromDbUser,
    userCanvases,
    userProjects,
    users,
} from '@onlook/db';
import { constructInvitationLink, getResendClient, sendInvitationEmail } from '@onlook/email';
import { ProjectRole } from '@onlook/models';
import { isFreeEmail } from '@onlook/utility';
import { TRPCError } from '@trpc/server';
import { addDays, isAfter } from 'date-fns';
import { and, eq, ilike, isNull } from 'drizzle-orm';
import { v4 as uuidv4 } from 'uuid';


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key