Project Case Study
Self-Hosted AI Content Engine
Production content pipeline running entirely on an RTX 5090: local LLM article generation, local diffusion imagery with deterministic typography, Discord-based human approval, and per-brand routing to three blogs and five social accounts.
ShippedOllama (Qwen3 30B)ComfyUI + FluxPythonDynamoDBS3TerraformPostiz
Problem
Publishing consistently across multiple brands means either paying metered API costs that scale with usage, or manual effort that doesn't scale at all — and autonomous posting without review risks putting a bad generation on a public account.
Goal
Zero marginal cost per post: generate everything locally on owned hardware, route each piece to exactly one brand's blog and social accounts, and gate every publish behind a human approval click.
Architecture Overview
System shape and flow

- Local Ollama (Qwen3 30B, upgraded from llama3.1:8b) generates articles and platform-specific variants in JSON mode with schema validation
- ComfyUI + Flux.1-schnell generates background art; a PIL compositing layer renders real typography, pillar-colored accents, and contrast-aware brand marks
- A routing layer maps each content pillar to one brand, and each brand to its own scoped social accounts — never falling back across brands
- Discord approval gate: every draft posts as an embed with Approve/Reject/Preview; a FastAPI service records the decision in DynamoDB and nothing publishes without it
- Three deploy paths, one per brand: git push into CodeBuild/S3/CloudFront, local terraform apply that uploads a static build, and direct writes to a live DynamoDB-backed API
- Self-hosted Postiz distributes approved posts to Instagram, Facebook, and LinkedIn via each platform's API, using media pre-uploaded to a public S3 bucket
Key Features
- Per-brand marketing pipelines with strict account isolation (no cross-brand credential fallback)
- Permanent post history in DynamoDB with feedback-driven iteration that republishes to the same URL
- Per-platform content: long-form LinkedIn posts with an architecture diagram, caption-style posts with branded title cards elsewhere
- Automatic CloudFront invalidation after each brand deploy completes
- Architecture diagrams rendered from code (Python diagrams + Graphviz) so published diagrams match the real system
Tradeoffs and Design Decisions
- Local small-model generation is free but needs a validation layer — JSON mode constrains syntax, not semantics, so every structured field is checked against its schema
- Owned-GPU inference inverts the cost curve (zero marginal cost per post) at the price of managing local infrastructure instead of calling a metered API
- A human approval gate caps full autonomy by design — ten seconds of review per post versus the reputational cost of one bad autonomous publish
Challenges
- First Instagram publish failed with 'media fetch failed': the scheduler served images from localhost, which Meta's servers can't reach — fixed by pre-uploading all media to a public S3 bucket
- Small local models sometimes echo an entire enum list instead of picking one value — solved with schema validation and preferring curated values over generated ones
- Small models also collapse output length on revision tasks — flagship long-form content is drafted by a stronger model and published verbatim, bypassing the local rewrite step
Results and Lessons Learned
- Three brands live from one approval flow: blog update + Instagram + Facebook on one brand, blog post + LinkedIn + personal socials on another, structured case study on the third
- Total running cost ~$2-5/month (DynamoDB + S3); generation cost $0 on owned hardware
- Every post permanently tracked and iterable: feedback in, improved revision out, same URL republished
Next Steps
- Wire the Remotion video pipeline (already rendering) into the daily flow for TikTok/YouTube Shorts
- Connect dedicated TikTok and YouTube business accounts for the education brand
- Add the next isolated brand pipeline (contracting company) to prove the multi-tenant routing design
- Schedule fully automated daily runs with the human gate as the only manual step