The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
enum PlanPeriod {
monthly
yearly
quarterly
biweekly
}
enum StripeConnectMode {
live
test
sandbox
}
model Project {
id String @id
name String
slug String @unique
logo String?
inviteCode String? @unique
plan String @default("free")
planTier Int @default(1)
planPeriod PlanPeriod? // monthly, yearly, etc. from Stripe price.recurring.interval
stripeId String? @unique // Stripe subscription ID
billingCycleStart Int // day of the month when the billing cycle starts
billingCycleEndsAt DateTime? // derived from Stripe current_period_end
trialEndsAt DateTime? // when set and in the future, the workspace is on a Stripe subscription free trial
subscriptionCanceledAt DateTime? // when the workspace's subscription was canceled (or set to cancel)
paymentFailedAt DateTime?
invoicePrefix String? @unique // prefix used to generate unique invoice numbers (for domain renewals)
stripeConnectId String? // for Stripe Integration
stripeConnectMode StripeConnectMode? // Stripe mode the account is connected in
shopifyStoreId String? @unique // for Shopify Integration
totalLinks Int @default(0) // Total number of links in the workspace
totalClicks Int @default(0) // Total number of clicks in the workspace
usage Int @default(0)
usageLimit Int @default(1000)
linksUsage Int @default(0)
linksLimit Int @default(25)
domainsLimit Int @default(3)
tagsLimit Int @default(5)
foldersUsage Int @default(0)
foldersLimit Int @default(0)
usersLimit Int @default(1)
aiUsage Int @default(0)
aiLimit Int @default(10)
store Json? // General key-value store for things like persisting toggles, dismissing popups, etc.
siteVisitTrackingSettings Json? // Site visit tracking: sitemaps, short-link domain, Site Links folder id
allowedHostnames Json?
publishableKey String? @unique // for the client-side publishable key
conversionEnabled Boolean @default(false) // Whether to enable conversion tracking for links by default
webhookEnabled Boolean @default(false)
dotLinkClaimed Boolean @default(false)
ssoEmailDomain String? @unique
ssoEnforcedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
usageLastChecked DateTime @default(now())
disabledAt DateTime?
users ProjectUsers[]
invites ProjectInvite[]
sentEmails SentEmail[]
links Link[]
domains Domain[]
tags Tag[]
invoices Invoice[]
customers Customer[]
defaultDomains DefaultDomains[]
restrictedTokens RestrictedToken[]
oAuthCodes OAuthCode[]
integrations Integration[] // Integrations workspace published
installedIntegrations InstalledIntegration[] // Integrations workspace installed
webhooks Webhook[]
folders Folder[]
registeredDomains RegisteredDomain[]
dashboards Dashboard[]
utmTemplates UtmTemplate[]
yearInReviews YearInReview[]
@@unique([stripeConnectId, stripeConnectMode])
@@index(usageLastChecked(sort: Asc))
@@index(trialEndsAt)
}
enum WorkspaceRole {
owner
member
viewer
billing
}
model ProjectInvite {
email String
expires DateTime
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
projectId String
role WorkspaceRole @default(member)
createdAt DateTime @default(now())
@@unique([email, projectId])
@@index([projectId])
}
model ProjectUsers {
id String @id @default(cuid())
role WorkspaceRole @default(member)
userId String
projectId String
notificationPreference NotificationPreference?
workspacePreferences Json?
defaultFolderId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
@@unique([userId, projectId])
@@index(projectId)
}
// TODO: could potentially combine this with NotificationEmail in the future?
model SentEmail {
id String @id @default(cuid())
type String
createdAt DateTime @default(now())
project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)
projectId String?
@@index(projectId)
}