The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
import { R2_URL } from "@dub/utils";
import * as z from "zod/v4";
import { uploadedImageSchema } from "./images";
export const integrationSchema = z.object({
id: z.string(),
projectId: z.string(),
name: z.string(),
slug: z.string(),
description: z.string().nullish(),
readme: z.string().nullish(),
developer: z.string(),
website: z.string(),
logo: z.string().nullish(),
screenshots: z.array(z.string()).nullish(),
installUrl: z.string().nullish(),
verified: z.boolean(),
guideUrl: z.string().nullish(),
comingSoon: z.boolean().nullish(),
createdAt: z.date(),
updatedAt: z.date(),
installations: z.number().default(0),
});
export const installedIntegrationSchema = integrationSchema.pick({
id: true,
projectId: true,
name: true,
slug: true,
description: true,
logo: true,
verified: true,
guideUrl: true,
comingSoon: true,
});
export const createIntegrationSchema = z.object({
name: z.string().min(1).max(100),
slug: z.string().min(1).max(100),
developer: z.string().min(1).max(100),
website: z
.url({
message: "website must be a valid URL",
})
.max(100),
installUrl: z
.url({
message: "installUrl must be a valid URL",
})
.nullish(),
logo: uploadedImageSchema.nullish().describe("The logo of the integration."),
description: z
.string()
.max(120, {
message: "must be 120 characters or fewer",
})
.nullish(),
readme: z
.string()
.max(5000, {
message: "must be 5000 characters or fewer",
})
.nullish(),
screenshots: z
.array(z.string())
.max(6, {
message: "up to 6 screenshots are allowed",
})
.transform((screenshots) =>
screenshots.map((screenshot) =>
screenshot.startsWith(R2_URL) ? screenshot : `${R2_URL}/${screenshot}`,
),
)
.default([]),
});