Auto-publishing content engine
A content back office + a 10-step pipeline that auto-publishes only grade-A articles, checks itself every 5 minutes and reports through Telegram, and lets search and preview bots see the real article from the minute it goes live.

5 articles a day for a live-commerce marketing site, with no writer
Project Overview
Built on top of the marketing site I made earlier: a content back office plus a 10-step pipeline where AI picks a topic, gathers sources, writes, fact-checks, grades, makes images and schedules the post. It publishes on its own only when an article gets grade A; everything else waits for a person. If the system gets stuck anywhere, Telegram sends an alert with the fix, because the owner does not open the back office every day.
The site needs new content every day but nobody writes it
The live-commerce platform's marketing site already had all its product pages, but ranking in search needs a steady stream of articles that answer online sellers' questions. The team has no full-time writer, and articles written purely by AI tend to be the kind nobody wants to read.
I want 5 trustworthy articles a day, with sources, their own images, published on schedule, and a clean preview when shared. If anything breaks, tell me in Telegram, because I don't open the back office every day.
AI can make things up
Articles about markets and selling tools need real numbers and real company names. If the AI guesses, the brand loses credibility.
AI costs balloon without gates
Cover and inline images cost several times more than text. Making images for an article that never gets published is money thrown away.
The system fails silently
An AI key runs out of credit, a news source changes its page, a job stalls halfway — if the only signal is an icon in the back office, nobody notices until several days of articles are missing.
The site is an SPA, but bots don't run JS
Pages are prerendered only at build time. Articles published later get the HTML of the listing page, so Google and the LINE/Facebook preview bots see the wrong page.
One back office, one scheduler, one alert channel
No new services — the pipeline and the health checker run inside the existing API, and job state is saved step by step in a Postgres table. If a pod dies halfway, the job resumes from the same step.
10 steps from a news topic to an article on the site
The scheduler moves each job one step every minute. Every step records its result, time and reasoning so a person can look back — gated steps hold the job for a human decision instead of letting a failed article go live.
- Find
- 1 Pick a topicfrom 25 news sources + ideas the team drops in the Inbox
- 2 Researchpulls real content with source links
- 3 Score the topic5 criteria × 5 = 25 · below 16 is dropped
- Write
- 4 Write the articleusing 12 Master Prompts editable in the back office
- 5 Fact-checkchecks every number/name against sources, fixes claims beyond the evidence
- 6 Grade A–D5 criteria × 20 = 100 · A ≥ 85 auto-publishes · lower = waits for review
- Images + audit
- 7 Cover + inline imagesphoto + headline template · share image 2400×1260
- 8 Audit + self-fixGoogle title/description, image alt, internal links
- Publish
- 9 Schedulespread evenly across 09:00–18:00
- 10 Go liveTelegram notice + English translation next
Gated step — a fail holds the job in the “Needs review” tab instead of publishing
Grade before making images and auto-publish only grade A
A second AI grades with a fixed rubric of 5 criteria, 20 points each — accuracy · depth · readability · SEO · usefulness — and the scores are stored with the article.
| Grade | Score | What the system does |
|---|---|---|
| A auto | 85–100 | Makes images, schedules, publishes, notifies Telegram |
| B | 70–84 | Saved as a draft in the “Needs review” tab with suggested fixes — a person can publish it |
| C / D | < 70 | Same as B, and treated as a sign that a prompt or news source has a problem |
- Grading moved ahead of image generation — images used to be made first and checked after, so articles that failed the grade wasted the image cost. With the gate moved up, images are paid for only on articles that will actually go live.
- The threshold is a back-office setting, not code — it started at 70 (B and up), which published 19 articles, 14 of them A. When the owner asked for “A only”, it went to 85 right away with no deploy. English translations use the same threshold.
- Covers are a photo + template, not pure AI images — the AI picks the scene and writes a 2-line headline, but the text is set by our own template so Thai type never comes out garbled, and the last 8 scenes are remembered so covers don't repeat.
Self-check every 5 minutes, problems go to Telegram
Nobody sees an icon in the back office — the system checks 11 things every 5 minutes, and anything that needs a person goes to Telegram with “how to fix it” and “what the system already did” in one message.
Tell failure types apart
401/403 = wrong key · 402 or the words quota/billing = out of credit · anything else = temporary outage — the first two never go away on retry, so it switches provider immediately instead of burning money in a loop.
Send on change, not every round
The “signature” of each problem already sent is stored in the database — it sends when a problem appears, gets worse or recovers, repeats every 6 hours if unresolved, and doesn't resend after a restart.
Content news comes from prod only
uat and prod share the same group bot, so the team got every “article published” message twice — the existing per-env pipeline off switch now decides who sends, with no new config value.
Daily summary
How many went out against the goal, at what times, in which categories, and how many are queued for tomorrow — you choose what goes into the message and preview the real message before turning it on.
Bots see the real article from the minute it goes live
The public site is static and built ahead of time, but articles go out daily — so the API serves the article's HTML itself whenever someone requests a path that hasn't been prerendered.
- HTML for bots — takes the built page shell and fills in the real article, title, canonical, og, hreflang and JSON-LD (BlogPosting + Breadcrumb), then leaves the article data in the page for Vue to pick up on hydrate without fetching again.
- A share image for every article in every language — 2400×1260 JPEG at about 80 KB, with a separate English-headline image for English versions. Checked against preview bots on 28/28 pages.
- Two languages that actually get indexed — per-language sitemaps under a sitemap index, hreflang th/en/x-default, llms.txt for AI search, and automatic English translations that pass the same grade gate as the Thai originals.
- Site-wide audit + “Optimize” — audits 26 pages for free without calling AI, and separates what AI can fix itself (title/description/alt/internal links) from what needs a code change. It runs every 2 weeks in “audit only, wait for a person to confirm” mode until its results can be trusted.
Problems you don't see on your own machine
Most showed up only on real Kubernetes, with several pods and a different timezone from the dev machine.
Set to publish 09:00–18:00, but articles went out 16:00–01:00
The whole system computes time in local time (publish slots, start of day, summary hour). On the dev machine that's Thai time, so nothing looked wrong, but the container runs in UTC, so everything shifted by 7 hours.
TZ=Asia/Bangkok in the image, a single line (Node on Alpine has ICU built in, so no tzdata needed), then moved that day's articles back into the right window — fixing the environment instead of chasing every place that computes time.
prod has 2 pods = the pipeline runs twice, AI cost ×2
The scheduler lives in the API, so every pod picked up the same jobs and Telegram sent duplicate summaries. The usual answer is a Postgres advisory lock, but the database connects through pgbouncer in transaction pooling mode, so session-level locks can't be trusted.
Article images had no width/height — and no table stored image sizes
Inline images live in markdown as bare URLs. The audit flagged layout shift on image load in all 14 articles, and adding an images table and backfilling every size would have been far too much work.
Cut ~3,100 lines of code while the pages stay identical to the character
The system grew fast and filled up with duplicates: 3 product pages with the same template, one form copied in 8 places, the same helper rewritten in 4–8 files, and libraries used in only one spot.
<dialog>) were skipped with the reasons written downNumbers from the live system
What I learned
Moving grading ahead of image generation improved quality and saved money without new code — the order of the steps matters as much as the steps.
The bell in the back office is for looking back. What keeps the system from failing silently is a Telegram message that states the problem, the fix, and what the system already did.
The auto-publish threshold and “fix it for me” are settings the owner controls. Start cautious, and loosen them after seeing results over several rounds.
Read next: Live-commerce marketing site — Vue 3 + Vite SSG the public site this system builds on
