Code: 02_ai-engineering-code/the-sea-star/lib/publish-workflow.ts + lib/ai.ts
Problem. One blog post for a bar should fan out to website, Facebook, Instagram, and an email blast — on a schedule and on-brand.
What I built. A workflow orchestrator where the LLM is one governed step:
publish-workflow.ts chains site → social → mailer, each channel independently set to now / schedule / skip.ai.ts calls Groq (llama-3.3-70b, JSON mode, temp 0.5) to generate platform-specific captions, pulling brand-voice guidelines from Supabase site_settings as context, enforcing hashtag/emoji/length rules and validating JSON output.scheduler handles time-based publishing.Stack & rigor. TypeScript · Next.js 14 · Supabase · Resend · dependency-injected (AppDeps) so the LLM and side-effects are mockable; full vitest + Playwright test:e2e + test:gate suite.
Why it matters. Shows LLM output treated as a structured, testable, brand-constrained step in a multi-channel pipeline — not a chat box.
Shipped status (confirmed). This is live in the Sea Star admin panel: staff author a post in app/admin/create/*, pick channels per row, and app/api/blog/publish/route.ts calls Groq inline to generate the captions; a Vercel cron (vercel.json, 6am Pacific) runs the scheduler; Supabase stores posts/campaigns/subscribers under RLS. Live: https://the-sea-star-sf.vercel.app · code: 02_ai-engineering-code/the-sea-star/api-blog-publish/route.ts.
GG · Applied AI Engineering portfolio · synced to youdontneedmy.help design