# Content Engine (v1.0 - MVP) **Status:** Live / MVP Implemented **Date:** Jan 20, 2026 **URL:** `/content/` ## 1. Vision & Purpose The **Content Engine** acts as the execution arm ("The Mouth") for the strategies developed in the GTM Architect ("The Brain"). It is a **Content Generation Dashboard** designed to produce high-quality, SEO-optimized, and sales-ready marketing assets based on the strategic foundation of the GTM Architect. **Core Philosophy:** * **SEO First:** Keywords guide the structure, not just metadata. * **Human-in-the-Loop:** Every generated asset is a draft that invites manual refinement. * **Context-Aware:** It inherits deep strategic knowledge (ICPs, Pain Points, Hybrid Service Logic) from the GTM Architect database. * **Tone:** Professional, fact-based, compelling, and "slightly aggressive" (Challenger Sale). ## 2. Architecture & Tech Stack ### Data Layer * **Persistence:** A dedicated SQLite database (`content_engine.db`) stores all content projects, SEO strategies, and drafts. * **Integration:** Read-only access to `gtm_projects.db` via Docker volume mounts to import strategy baselines. ### The Stack * **Frontend:** React (Vite + TypeScript + Tailwind CSS). * **Backend:** Node.js Bridge (`server.cjs`, Express) communicating with a Python Orchestrator (`content_orchestrator.py`). * **Container:** Dockerized service (`content-app`), integrated into the central Nginx Gateway. ## 3. Implemented Features (MVP) ### Phase 1: Project Setup & Import * [x] **GTM Bridge:** Lists and imports strategies directly from GTM Architect. * [x] **Context Loading:** Automatically extracts Product Category, ICPs, and Core Value Propositions. ### Phase 2: SEO Strategy * [x] **AI Brainstorming:** Generates 15 strategic Seed Keywords (Short & Long Tail) based on the imported strategy. * [x] **Persistence:** Saves the chosen SEO strategy to the database. ### Phase 3: Website Copy Generator * [x] **Section Generator:** Generates structured copy for: * **Hero Section** (Headline, Subline, CTA) * **Challenger Story** (Problem/Agitation) * **Value Proposition** (Hybrid Solution Logic) * **Feature-to-Value** (Tech Deep Dive) * [x] **Editor UI:** Integrated Markdown editor for manual refinement. * [x] **Copy-to-Clipboard:** Quick export for deployment. ## 4. Lessons Learned (Development Log) ### Docker & Networking * **Volume Mounts:** Never mount a local folder over a container folder that contains build artifacts (like `node_modules` or `dist`). *Solution:* Build frontend inside Docker and serve via Node/Express static files, or be extremely precise with volume mounts. * **Nginx Routing:** Frontend fetch calls must use **relative paths** (e.g., `api/import` instead of `/api/import`) to respect the reverse proxy path (`/content/`). Absolute paths lead to 404/502 errors because Nginx tries to route them to the root. * **502 Bad Gateway:** Often caused by the Node server crashing immediately on startup. *Common cause:* Missing backend dependencies (like `express`) in the Docker image because `package.json` wasn't copied/installed for the backend context. ### Frontend (Vite/React) * **TypeScript Configuration:** `tsc` requires a valid `tsconfig.json`. Without it, `npm run build` fails silently or with obscure errors. * **Linting vs. Prototyping:** Strict linting (`noUnusedLocals: true`) is good for production but blocks rapid prototyping. *Solution:* Relax rules in `tsconfig.json` during MVP phase. * **ES Modules vs. CommonJS:** When `package.json` has `"type": "module"`, configuration files like `postcss.config.js` MUST be renamed to `.cjs` if they use `module.exports`. ### Python & Backend * **Standard Libs:** Do NOT include standard libraries like `sqlite3` in `requirements.txt`. Pip will fail. * **Strings in Prompts:** ALWAYS use `r"""..."""` (Raw Strings) for prompts to avoid syntax errors with curly braces in JSON templates. ## 5. Roadmap * **LinkedIn Matrix:** Generate posts for (Persona x Content Type). * **Outbound Email:** Cold outreach sequences. * **Press Kit:** Automated PR generation.