End-to-end AI campaign pipeline — market research, strategy, ad creative, and multi-platform publishing.
Full OAuth2 + billing + AI pipeline shipped end-to-end
01 / Context
AI-native ad campaign platform where users go from brief to published ads across Meta, LinkedIn, and Google — all driven by LLMs.
02 / The Problem
Monolithic Express backend couldn't scale to isolated billing, auth, and campaign domains. LLM outputs were unreliable with no schema enforcement or repair.
03 / Key Decisions & Tradeoffs
Chosen
NestJS modular monolith with isolated domain modules
Alternative
Keep the existing monolithic Express backend
Rationale
Needed isolated domains for auth, billing, campaigns, and publishing that could be tested and deployed independently � the monolith was coupling unrelated logic together.
Chosen
Structured outputs with automatic schema-repair on malformed responses
Alternative
Raw LLM text parsing with manual error handling
Rationale
Raw LLM responses were unreliable and broke downstream pipeline steps. A validation + auto-repair layer made the AI pipeline deterministic in production.
Chosen
BullMQ/Redis job queues for image generation and scheduled publishing
Alternative
Synchronous API calls inline with the request
Rationale
Image generation and social platform publishing are slow � offloading to queues kept API responses fast and gave reliable retry semantics with circuit-breaker protection.
04 / Hard Parts
Root-caused a timeout library bug silently breaking OAuth callbacks. Built an agentic assistant with tool calling to query live campaign data. Schema-repair on malformed LLM outputs. Custom OAuth-mocking framework for deterministic edge-case testing.
05 / Outcome
Full NestJS migration on Clean Architecture with domain isolation across auth, billing, campaigns, integrations, and publishing. BullMQ job queues for image gen and scheduled publishing with circuit-breaker/retry around every third-party call.
Tech Stack
Full walkthrough available on request — reach out.