Open source CapCut alternative.
TypeScript
// What an account has been through on the way in: the welcome sequence, and
// the answers it collected. One row per user, written the first time the
// sequence opens. Referral source ids live in code
// (src/lib/onboarding/sequence.ts); the route accepts only those.
model UserOnboarding {
userId String @id
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
// The sequence this account saw. Raising ONBOARDING_VERSION in code shows a
// rewritten sequence again to accounts that only finished an older one.
version Int @default(1)
// Null until the sequence ends; `skipped` says how it ended.
completedAt DateTime?
skipped Boolean @default(false)
// When the slides ended and the starter tour took over; null until then.
slidesDoneAt DateTime?
// The starter tour steps this account has done (TOUR_STEPS ids).
tourSteps String[] @default([])
// Every source the account picked; the question takes more than one answer.
referralSources String[] @default([])
// The free text that comes with picking "other".
referralOther String?
referralAnsweredAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
// What stays behind when an account is deleted: a hash of its address, and
// the credits it was granted and spent. Signup reads it so an address that
// already received its signup credits starts a second account with none.
// Rows carry no foreign key; they outlive the user they came from.
model DeletedAccount {
// sha256 of the lowercased address, so the table holds no email.
emailHash String @id
userId String
signedUpAt DateTime
deletedAt DateTime @default(now())
grantedMicros BigInt @default(0)
chargedMicros BigInt @default(0)
}
// How many signup credit grants one network has taken in its current window.
// Signup claims one before granting; a network at the
// signupCreditsPerNetwork limit gives later accounts none until the window
// lapses.
model SignupNetwork {
// HMAC of the network address (an IPv6 address collapsed to its /64), so
// the table holds no address.
networkKey String @id
windowStart DateTime
claims Int @default(0)
}