Delivered remotely for a business based in Berlin, Germany. Names withheld by agreement.
Project Overview
Publishing teams operating across multiple product lines, regional markets, and campaign channels rarely struggle to produce raw words—they struggle to produce consistent, compliant drafts that respect brand voice without bogging senior editors down in repetitive cleanup. Handing writers unconfigured chat windows shifts effort from drafting to endless prompt tweaking, manual fact-checking, and copy-pasting blocks into headless content systems.
Partnering with a marketing technology team in Berlin, Germany, we architected a brand-governed AI content generation platform combining Python, Node.js, TypeScript, BullMQ, PostgreSQL, Redis, and external LLM APIs. Rather than treating generation as a single prompt-in, text-out call, the system models content creation as a deterministic editorial assembly line: structured briefs become approved outlines, section drafts undergo automated terminology linting, and finalized blocks sync cleanly into external CMS repositories.
Editorial Bottlenecks & Brand Drift
Moving enterprise marketing workflows beyond ad-hoc prompt experiments surfaced concrete engineering gaps:
- One-shot structural drift: Asking an LLM for a complete article or campaign pack in one pass produces generic pacing and misses subtle audience emphasis until the entire piece is already written.
- Terminology & compliance leakage: Without deterministic post-checks, models casually reintroduce deprecated product names, banned superlatives, or unapproved compliance phrasing.
- Orchestration bottlenecks on batch runs: Localizing a campaign brief across six languages or twenty channel variants saturates synchronous API handlers and triggers upstream provider rate-limit cascades.
- Copy-paste friction: Plain markdown blobs force content managers to manually rebuild rich metadata, SEO fields, and structured blocks inside headless CMS dashboards.
Architectural Strategy
We divided system responsibilities cleanly along runtime strengths. Node.js and TypeScript power the public API gateway, role-based workspace permissions, BullMQ workflow state machines, and headless CMS webhook adapters. Python runs dedicated AI pipeline microservices responsible for style-guide grounding, staged outline-to-section generation, readability scoring, and deterministic compliance linting.
Every long-form or multi-asset brief moves through explicit state checkpoints stored in PostgreSQL: brief_validated → outline_pending_approval → sections_generating → lint_checked → editor_ready. Editors intervene at the outline gate where adjustments take seconds, while automated workers enforce brand guardrails consistently on every generated variant.
Core Capabilities
- Workspace Brand Rulesets: Teams maintain versioned glossaries, tone directives, audience personas, and forbidden-term lists per brand or product line in PostgreSQL.
- Gated Outline-to-Draft Workflows: Generators propose structured section blueprints tied to brief objectives; once approved, parallel section workers draft cohesive prose with cross-section context summaries.
- Automated Terminology & Claim Linting: Deterministic Python analyzers flag prohibited vocabulary, missing legal disclaimers, passive-voice spikes, and unsupported product assertions with inline remediation hints.
- Batch Localization & Channel Fan-Out: Single approved master briefs fan out via BullMQ child queues into region-specific variants and channel formats (social hooks, email sequences, landing copy) respecting locale glossaries.
- Structured CMS Export & Diff History: Completed deliverables map directly to typed CMS field schemas (slug, meta tags, body blocks) with full revision history and prompt provenance.
Technical Architecture
Node.js orchestrates the editorial lifecycle and queues work onto Redis-backed BullMQ pipelines, delegating generative reasoning and rule-based verification to stateless Python services.
Flow: Web Workspace → Node.js API & Editorial State Machine (PostgreSQL) → BullMQ Job Dispatcher (Redis) → Python Prompt & Style Assembler → External LLM APIs (Structured Schema Output) → Python Compliance Linter → Node.js Headless CMS Connector
Using BullMQ parent-child job flows kept batch generation predictable. When a marketing lead triggers a multi-locale campaign, Node.js spawns isolated child jobs per asset with strict per-provider concurrency tokens in Redis. Failed upstream calls retry selectively at the section level without discarding completed work or restarting entire briefs.
Technology Stack
| Category | Technology detail |
|---|---|
| API Gateway & Workflow Engine | Node.js with TypeScript and BullMQ orchestrating editorial state machines |
| AI Pipeline Services | Python microservices handling style retrieval, multi-step generation, and linting |
| Model Orchestration | External LLM APIs with task-specific model routing and JSON schema enforcement |
| Relational & Brand Store | PostgreSQL storing brand glossaries, editorial briefs, revisions, and audit logs |
| Queue & Cache Backbone | Redis powering BullMQ job pipelines, webhook retries, and token-budget counters |
| Compliance Linter | Python deterministic rule engine checking banned terms, claims, and readability |
| CMS & Webhook Adapters | Node.js connectors syncing structured blocks to headless CMS endpoints |
| Observability | Structured job telemetry tracking stage failure rates, lint hits, and API cost |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Coordinating Node.js workflow APIs with Python NLP/LLM services | Connected services over typed internal HTTP contracts and shared Redis/PostgreSQL state; adds explicit cross-service schema maintenance while letting each team leverage its strongest ecosystem. |
| Maintaining narrative continuity across parallel section generation | Generated a compact transition plan during outline lock and passed preceding section summaries into worker contexts, trading slight sequential ordering in long articles for coherent tone and fewer repetitions. |
| Catching subtle brand violations without over-relying on LLM self-critique | Built a deterministic Python linter combining glossary matchers, regex rules, and readability metrics alongside optional semantic checks, ensuring repeatable rule enforcement at near-zero runtime cost. |
| Preventing runaway token spend during bulk campaign retries | Enforced per-workspace Redis token budgets and BullMQ dead-letter limits before dispatching LLM calls, pausing malformed batch jobs cleanly rather than draining API quotas silently. |
Security, Provenance & Reliability
Enterprise marketing workspaces routinely house embargoed product launches and regulated financial or healthcare phrasing. Role-based access controls in Node.js isolate brand libraries and draft repositories strictly by workspace and editorial role. Upstream model calls route exclusively to zero-data-retention enterprise LLM API endpoints with encrypted transit, and outbound CMS webhooks sign payloads via HMAC headers.
Every published asset retains immutable provenance metadata in PostgreSQL linking the final draft back to the brief version, brand glossary snapshot, model configuration, and lint report that cleared it for publication.
Operational Outcomes
Moving content automation onto a dual-runtime, rule-checked pipeline gave editorial teams speed without sacrificing governance:
- Consistent brand fidelity: Automated glossary enforcement and pre-draft style injection catch off-brand phrasing before human editors even open review queues.
- Targeted human editing: Locking structural outlines upfront lets managing editors shape arguments early instead of rewriting entire generated drafts.
- Fault-tolerant batch execution: BullMQ child queues isolate transient LLM rate limits to individual sections or locales, keeping large multi-channel launches moving smoothly.
- Clean CMS integration: Typed block outputs eliminate manual reformatting between AI drafting tools and production publishing pipelines.