Open source CapCut alternative.
TypeScript
// Founder outreach: one row per account per campaign, seeded by the nightly
// outreach-scan job in the back office and worked by hand. The
// row is a marker, not a mailbox — it carries status, timestamps, and the
// scan's credit snapshot, never a subject or a message body. The conversation
// itself lives in the operator's inbox.
model UserOutreach {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
// Campaign ids live in code (the back office's campaigns).
campaign String
// "todo" | "sent" | "replied" | "ignored". The scan creates and retires
// "todo" rows; every other status is set by a person or by an inbound reply.
status String @default("todo")
sentCount Int @default(0)
firstSentAt DateTime?
lastSentAt DateTime?
repliedAt DateTime?
ignoredAt DateTime?
// The super user who sent or filed the row.
actorUserId String?
// The scan's snapshot, so the list renders from this table alone.
spentMicros BigInt @default(0)
balanceMicros BigInt @default(0)
// Cloud media the account was holding when the scan ran.
storageBytes BigInt @default(0)
lastActiveAt DateTime?
// When the balance last reached zero; null for an account still in credit.
ranOutAt DateTime?
// Why the scan listed the account (ids in the back office's campaigns).
reasons String[] @default([])
// The latest declined Stripe charge inside the payment window.
paymentFailedAt DateTime?
scannedAt DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([userId, campaign])
@@index([campaign, status, lastActiveAt])
}
// A saved outreach template: the words the operator wrote, kept so the next
// note can start from them. Templates live here rather than in the repo, so
// writing one never needs a deploy. Sending still sends whatever is in the
// dialog at the time — a template is a starting point, not a contract.
model OutreachTemplate {
promotion Json?
id String @id @default(cuid())
// What the send dialog calls it. Unique, so saving under an existing name
// updates that template instead of leaving two the operator can't tell apart.
name String @unique
subject String
body String
// The send toggles the template opens with: the opt-out footer, and routing
// replies through the signed alias that marks the row replied.
unsubscribeLink Boolean @default(true)
trackReplies Boolean @default(true)
// The super user who last saved it.
actorUserId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
// A promotion is one email sent to a segment: an audience
// (the experiment rules, minus country) and, optionally, everyone who already
// received earlier promotions left out. The words live here so a draft can be
// edited, test-sent and counted before anything goes out. Sending resolves the
// segment into outbox rows once (EmailSend, prisma/Email.prisma) and the
// outbox drainer mails them under the day's quota.
model Promotion {
creditOffer Json?
id String @id @default(cuid())
name String
subject String
body String
ctaLabel String?
ctaUrl String?
// "bulk" sends from the list address, "personal" from the operator's own.
sender String @default("bulk")
// Who gets it (src/lib/config/audience via @donkeycut/abexp). {} admits everyone.
audience Json @default("{}")
// Earlier promotions whose recipients are skipped.
excludePromotionIds String[] @default([])
// "draft" | "queuing" | "sending" | "paused" | "sent"
status String @default("draft")
startedAt DateTime?
finishedAt DateTime?
actorUserId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sends EmailSend[]
@@index([status, createdAt])
}