Skip to content

Commit 4c6dba9

Browse files
authored
Merge pull request #135 from peelar/feat/background-generation
add background generation
2 parents fbdc8b0 + c596630 commit 4c6dba9

62 files changed

Lines changed: 4597 additions & 384 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/gentle-jobs-cut.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"dopeshot-app": minor
3+
---
4+
5+
Move the "brand" tab into the new left sidebar with other logged-in-user related tabs (like billing, account, saved).

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@ test-results/
5252
playwright-report/
5353
.codex/
5454

55-
.vercel
55+
.vercel
56+
57+
# AI background seeding manifests
58+
apps/app/data/ai-backgrounds/seeds.json
59+
apps/app/data/ai-backgrounds/discards.json

apps/app/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ GOOGLE_CLIENT_SECRET=your-google-client-secret
4141

4242
# Optional: used by Sentry to recognize your production host
4343
NEXT_PUBLIC_SITE_URL=https://app.dopeshot.io
44+
REPLICATE_API_TOKEN=
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
{
2+
"version": 1,
3+
"widthPx": 1920,
4+
"heightPx": 1080,
5+
"basePrompt": "abstract background, low detail, soft shapes, high negative space, overlay-friendly, no text, no logos, no people, no faces, no readable symbols, avoid photographic realism, matte finish, low contrast, gentle gradients, no hard edges",
6+
"negativePrompt": "text, logo, watermark, signature, people, faces, words, letters, numbers, photo realism",
7+
"repeatAvoidance": {
8+
"enabled": true,
9+
"lookback": 200,
10+
"maxRetries": 8
11+
},
12+
"variantsPerPrompt": 3,
13+
"promptVariants": [
14+
"soft radial gradient",
15+
"subtle vignette",
16+
"diffuse bloom",
17+
"airbrushed transitions",
18+
"misty color wash",
19+
"soft bokeh haze",
20+
"gentle diagonal flow",
21+
"horizontal banding",
22+
"quiet center glow",
23+
"soft gradient mesh",
24+
"low-contrast glow",
25+
"feathered edges",
26+
"light falloff",
27+
"delicate color drift",
28+
"calm tonal shifts",
29+
"subtle noise field",
30+
"smooth diffusion",
31+
"soft edge lighting"
32+
],
33+
"personalityVariants": {
34+
"kawaii": [
35+
"pastel peach blush",
36+
"lavender mint haze",
37+
"sparkle dust",
38+
"opalescent mist",
39+
"cotton candy haze"
40+
],
41+
"hacker": [
42+
"cyan edge glow",
43+
"faint scanline hint",
44+
"deep indigo wash",
45+
"neon edge glints",
46+
"cool blue pulse",
47+
"faint grid traces"
48+
],
49+
"hipster": [
50+
"screenprint grain",
51+
"matte paper texture",
52+
"sun-faded edges",
53+
"dusty film grain",
54+
"sun-bleached paper"
55+
],
56+
"founder": [
57+
"cool neutral wash",
58+
"warm accent glow",
59+
"foggy bay light",
60+
"cool glass sheen",
61+
"soft neutral wash"
62+
]
63+
},
64+
"orchestration": {
65+
"version": 1,
66+
"countPerPersonality": 3,
67+
"underrepresented": {
68+
"enabled": true,
69+
"topN": 2,
70+
"bonusPerPersonality": 2,
71+
"fallbackPersonalities": ["hipster"]
72+
},
73+
"models": [
74+
{
75+
"provider": "replicate",
76+
"model": "aolaru/abstract-flux-backgrounds",
77+
"countPerPersonality": 4,
78+
"widthPx": 1440,
79+
"heightPx": 810
80+
},
81+
{
82+
"provider": "replicate",
83+
"model": "prunaai/p-image",
84+
"countPerPersonality": 4,
85+
"widthPx": 1440,
86+
"heightPx": 816
87+
},
88+
{
89+
"provider": "replicate",
90+
"model": "prunaai/z-image-turbo",
91+
"countPerPersonality": 3,
92+
"widthPx": 1920,
93+
"heightPx": 1088
94+
},
95+
{
96+
"provider": "replicate",
97+
"model": "black-forest-labs/flux-schnell",
98+
"countPerPersonality": 3
99+
},
100+
{
101+
"provider": "replicate",
102+
"model": "black-forest-labs/flux-2-pro",
103+
"countPerPersonality": 2
104+
}
105+
]
106+
},
107+
"personalityPrompts": {
108+
"kawaii": [
109+
"dreamy pastel clouds, plush bubble shapes, candy colors, airbrushed texture, gentle glow",
110+
"anime-inspired bokeh haze, soft star confetti, pastel pink lavender mint, misty soft shapes",
111+
"cute abstract blobs, jelly texture, light sparkles, soft focus, minimal contrast",
112+
"cotton candy cloud swirls, pearlescent haze, soft sunrise palette, smooth diffusion",
113+
"opalescent bokeh mist, pastel confetti dust, airy gradients, soft glow",
114+
"soft plush gradients, pastel mochi haze, gentle sparkle dust, airy softness",
115+
"pearly cloud veil, pastel glow, soft diffusion, minimal contrast"
116+
],
117+
"hacker": [
118+
"dark abstract background with neon circuitry fragments, cyan magenta accents, subtle scanlines, soft glow",
119+
"soft glitchy data blocks, diffused neon haze, deep charcoal base, low contrast, subtle noise texture",
120+
"digital lattice abstraction, green cyan highlights, blurred edges, moody tech vibe",
121+
"midnight indigo fog, thin electric linework, teal accents, soft bloom, low detail",
122+
"graphite noise field, faint grid traces, cool blue pulse, gentle haze",
123+
"deep charcoal gradient, neon edge glints, soft diffusion, minimal detail",
124+
"deep graphite fog, faint grid traces, sparse cyan glints, low contrast",
125+
"dim neon edge glints on dark matte field, cool blue pulse, soft diffusion"
126+
],
127+
"hipster": [
128+
"mid-century abstract shapes, muted earth tones, paper cutout texture, soft shadows, screenprint grain",
129+
"retro geometric blobs, warm ochre teal palette, matte paper texture, soft edges",
130+
"sun-faded colorfield wash, muted terracotta sage palette, soft paper fibers, gentle gradient bands, matte finish",
131+
"vintage print wash, dusty palette, subtle grain, layered shapes, calm composition",
132+
"muted colorfield wash, broad soft gradients, low texture, calm composition",
133+
"dusty pastel planes, subtle light falloff, airy negative space",
134+
"soft geometric overlays, desaturated palette, gentle haze, minimal texture",
135+
"painterly landscape wash, soft horizon bands, muted earth blues, gentle paper texture, low detail"
136+
],
137+
"founder": [
138+
"clean minimal abstract waves, cool neutral palette with single accent, soft lighting, subtle noise",
139+
"soft glassy panels, light gray blue base, gentle depth, minimal texture",
140+
"modern geometric layers, desaturated palette, soft edges, minimal detail",
141+
"bay area morning fog, soft cloudy gradients, muted blue gray palette, airy negative space",
142+
"minimal cloud wash, cool neutrals with one warm accent, gentle glow, low detail",
143+
"silvery fog wash, cool neutral palette, subtle glow, minimal texture",
144+
"clean glass gradient panels, cool gray base, subtle depth, minimal detail",
145+
"painterly landscape wash, soft horizon bands, muted blue lavender, airy gradients, low detail"
146+
]
147+
}
148+
}

apps/app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"test:ci": "pnpm typecheck && pnpm test:ui && pnpm test:e2e",
1818
"check": "pnpm lint && pnpm typecheck && pnpm test:ui && pnpm test:e2e",
1919
"release": "pnpm -w changeset:version && pnpm check",
20-
"db:dev": "prisma migrate dev"
20+
"db:dev": "prisma migrate dev",
21+
"seed:ai-backgrounds": "tsx scripts/seed-ai-backgrounds.ts"
2122
},
2223
"dependencies": {
2324
"@base-ui/react": "^1.0.0",

apps/app/prisma/migrations/20260128130000_restore_personal_backgrounds_table/migration.sql

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,21 @@ CREATE TABLE IF NOT EXISTS "personal_backgrounds" (
1818
-- CreateIndex
1919
CREATE INDEX IF NOT EXISTS "personal_backgrounds_user_id_idx" ON "personal_backgrounds"("user_id");
2020

21-
-- AddForeignKey
22-
ALTER TABLE "personal_backgrounds" ADD CONSTRAINT "personal_backgrounds_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
21+
-- AddForeignKey (guarded for existing schema)
22+
DO $$
23+
BEGIN
24+
IF NOT EXISTS (
25+
SELECT 1
26+
FROM pg_constraint
27+
WHERE conname = 'personal_backgrounds_user_id_fkey'
28+
AND conrelid = 'public.personal_backgrounds'::regclass
29+
) THEN
30+
ALTER TABLE "personal_backgrounds"
31+
ADD CONSTRAINT "personal_backgrounds_user_id_fkey"
32+
FOREIGN KEY ("user_id") REFERENCES "user"("id")
33+
ON DELETE CASCADE ON UPDATE CASCADE;
34+
END IF;
35+
END $$;
2336

2437
-- CreateTable (if not exists)
2538
CREATE TABLE IF NOT EXISTS "background_selections" (
@@ -35,5 +48,18 @@ CREATE TABLE IF NOT EXISTS "background_selections" (
3548
-- CreateIndex
3649
CREATE UNIQUE INDEX IF NOT EXISTS "background_selections_user_id_key" ON "background_selections"("user_id");
3750

38-
-- AddForeignKey
39-
ALTER TABLE "background_selections" ADD CONSTRAINT "background_selections_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
51+
-- AddForeignKey (guarded for existing schema)
52+
DO $$
53+
BEGIN
54+
IF NOT EXISTS (
55+
SELECT 1
56+
FROM pg_constraint
57+
WHERE conname = 'background_selections_user_id_fkey'
58+
AND conrelid = 'public.background_selections'::regclass
59+
) THEN
60+
ALTER TABLE "background_selections"
61+
ADD CONSTRAINT "background_selections_user_id_fkey"
62+
FOREIGN KEY ("user_id") REFERENCES "user"("id")
63+
ON DELETE CASCADE ON UPDATE CASCADE;
64+
END IF;
65+
END $$;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-- Extend personal backgrounds with source metadata
2+
ALTER TABLE "personal_backgrounds"
3+
ADD COLUMN IF NOT EXISTS "source_type" TEXT NOT NULL DEFAULT 'upload',
4+
ADD COLUMN IF NOT EXISTS "source_id" TEXT;
5+
6+
-- Create AI background catalog table
7+
CREATE TABLE IF NOT EXISTS "ai_backgrounds" (
8+
"id" TEXT NOT NULL,
9+
"personality" TEXT NOT NULL,
10+
"status" TEXT NOT NULL,
11+
"provider" TEXT NOT NULL,
12+
"model" TEXT NOT NULL,
13+
"prompt" TEXT,
14+
"seed" INTEGER,
15+
"storage_path" TEXT NOT NULL,
16+
"preview_url" TEXT NOT NULL,
17+
"file_size_kb" INTEGER NOT NULL,
18+
"width_px" INTEGER NOT NULL,
19+
"height_px" INTEGER NOT NULL,
20+
"file_format" TEXT NOT NULL,
21+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
22+
"updated_at" TIMESTAMP(3) NOT NULL,
23+
24+
CONSTRAINT "ai_backgrounds_pkey" PRIMARY KEY ("id")
25+
);
26+
27+
-- Index for fast catalog queries
28+
CREATE INDEX IF NOT EXISTS "ai_backgrounds_personality_status_idx" ON "ai_backgrounds"("personality", "status");
29+
30+
-- Ensure background selections can reference catalog by type
31+
-- (No schema change required; background_type is TEXT)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE "public"."user_metadata"
2+
ADD COLUMN "is_admin" BOOLEAN NOT NULL DEFAULT false;

apps/app/prisma/schema.prisma

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ model UserMetadata {
113113
id String @id @default(cuid())
114114
userId String @unique @map("user_id")
115115
exportsThisMonth Int @default(0) @map("exports_this_month")
116+
isAdmin Boolean @default(false) @map("is_admin")
116117
117118
subscriptionTier String @default("free") @map("subscription_tier")
118119
subscriptionStatus String @default("active") @map("subscription_status")
@@ -174,6 +175,8 @@ model PersonalBackground {
174175
widthPx Int @map("width_px")
175176
heightPx Int @map("height_px")
176177
fileFormat String @map("file_format")
178+
sourceType String @default("upload") @map("source_type")
179+
sourceId String? @map("source_id")
177180
createdAt DateTime @default(now()) @map("created_at")
178181
updatedAt DateTime @updatedAt @map("updated_at")
179182
@@ -184,6 +187,28 @@ model PersonalBackground {
184187
@@schema("public")
185188
}
186189

190+
model AiBackground {
191+
id String @id @default(cuid())
192+
personality String
193+
status String
194+
provider String
195+
model String
196+
prompt String?
197+
seed Int?
198+
storagePath String @map("storage_path")
199+
previewUrl String @map("preview_url")
200+
fileSizeKb Int @map("file_size_kb")
201+
widthPx Int @map("width_px")
202+
heightPx Int @map("height_px")
203+
fileFormat String @map("file_format")
204+
createdAt DateTime @default(now()) @map("created_at")
205+
updatedAt DateTime @updatedAt @map("updated_at")
206+
207+
@@index([personality, status])
208+
@@map("ai_backgrounds")
209+
@@schema("public")
210+
}
211+
187212
model BackgroundSelection {
188213
id String @id @default(cuid())
189214
userId String @unique @map("user_id")

0 commit comments

Comments
 (0)