feat: complete marketing command center with pipeline, UI, and asset generation

- Dashboard with campaign management, asset gallery, and publishing queue
- 7-agent pipeline: trend scout, research, scripts, ad creative, video, copy, distribution
- Campaign form with screenshot upload, goal picker, platform selection
- Campaign detail view with Details/Pipeline/Assets/Chat tabs
- Two-set image generation: Gemini AI (NanoBanana MCP) + Canvas Design posters
- Remotion video rendering with phone.png frame and real screenshot alignment
- honeyDue branding: blue #0079FF, orange #FF9400, Inter font, warm off-white
- Asset cards with source badges (Gemini/Canvas/Remotion/Playwright)
- Markdown/JSON render endpoint for viewing pipeline outputs as HTML
- Settings page with Tavily, Gemini, Postiz, Nextdoor integration management
- Claude Chat for campaign feedback loop with streaming SSE
- Postiz publishing modal with scheduling
- Auth with NextAuth credentials + JWT sessions
- SQLite via Prisma with better-sqlite3 adapter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-03-23 21:05:26 -05:00
parent 6b08cfb73a
commit 66c2bbec8b
113 changed files with 12741 additions and 138 deletions
+83
View File
@@ -0,0 +1,83 @@
import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import {
createNextdoorCampaign,
createNextdoorAdGroup,
uploadNextdoorCreative,
createNextdoorAd,
} from "@/lib/nextdoor";
export async function POST(request: Request) {
const session = await auth();
if (!session) return new Response("Unauthorized", { status: 401 });
const { assetIds, budget, schedule, targeting, copy } = await request.json();
if (!assetIds?.length) {
return Response.json({ error: "assetIds required" }, { status: 400 });
}
try {
// Create campaign
const campaignResult = await createNextdoorCampaign(
`Auto Campaign ${new Date().toISOString().slice(0, 10)}`,
budget || 50,
schedule || {
startDate: new Date().toISOString(),
endDate: new Date(Date.now() + 7 * 86400000).toISOString(),
}
);
const ndCampaignId = campaignResult.createCampaign.campaign.id;
// Create ad group
const adGroupResult = await createNextdoorAdGroup(
ndCampaignId,
targeting || {}
);
const adGroupId = adGroupResult.createAdGroup.adGroup.id;
const results = [];
for (const id of assetIds) {
const asset = await prisma.asset.findUnique({ where: { id } });
if (!asset) continue;
try {
// Upload creative (requires public URL — would need Postiz upload first)
const creativeResult = await uploadNextdoorCreative(
`/api/files/${asset.filePath}`
);
const creativeId = creativeResult.createCreative.creative.id;
// Create ad
const metadata = asset.metadata ? JSON.parse(asset.metadata) : {};
await createNextdoorAd(adGroupId, creativeId, {
headline: metadata.headline || "Check this out",
body: metadata.caption || "",
ctaText: copy?.ctaText || "Learn More",
destinationUrl: copy?.destinationUrl || "https://example.com",
});
await prisma.asset.update({
where: { id },
data: { status: "published", publishedTo: JSON.stringify(["nextdoor"]) },
});
results.push({ id, status: "published" });
} catch (error) {
results.push({
id,
status: "failed",
error: error instanceof Error ? error.message : "Unknown error",
});
}
}
return Response.json({ campaignId: ndCampaignId, adGroupId, results });
} catch (error) {
return Response.json(
{ error: error instanceof Error ? error.message : "Failed" },
{ status: 500 }
);
}
}