AutomationProjects

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.

10 min read

5 articles a day for a live-commerce marketing site, with no writer

CMS · AI Content PipelineNov 2026SEOTelegram alertVue 3Vite SSGExpressPrismaPostgreSQLOpenAIGeminisharpS3 + CDNKubernetesTelegram Bot APIPlaywright

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.

Empathize · Define

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.

— brief from the system owner

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.


Ideate

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.

Team · Readers · Search/preview bots
Vue 3 back officeVue SSG siteTelegram
↓
API · Express + Prisma
10-step pipelineHealth check every 5 minHTML for botsSEO audit
↓
External
OpenAI → Gemini (text)Gemini (images)25 news sources
↓
Infrastructure
PostgreSQLS3 + CDNKubernetes ≥ 2 replicaGitOps · uat → prod
Back-office dashboard showing today's goal at 0 of 5 articles, a 14-day bar chart of articles published per day with a target line at 5, and summary cards for total articles, drafts, scheduled, reads and visitors. Logo and profile photo are blurred
The dashboard measures everything against the “5 a day” goal — real data from the live system (logo blurred)

Prototype · Pipeline

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.

  1. Find
    1. 1 Pick a topicfrom 25 news sources + ideas the team drops in the Inbox
    2. 2 Researchpulls real content with source links
    3. 3 Score the topic5 criteria × 5 = 25 · below 16 is dropped
  2. Write
    1. 4 Write the articleusing 12 Master Prompts editable in the back office
    2. 5 Fact-checkchecks every number/name against sources, fixes claims beyond the evidence
    3. 6 Grade A–D5 criteria × 20 = 100 · A ≥ 85 auto-publishes · lower = waits for review
  3. Images + audit
    1. 7 Cover + inline imagesphoto + headline template · share image 2400×1260
    2. 8 Audit + self-fixGoogle title/description, image alt, internal links
  4. Publish
    1. 9 Schedulespread evenly across 09:00–18:00
    2. 10 Go liveTelegram notice + English translation next

Gated step — a fail holds the job in the “Needs review” tab instead of publishing

Pipeline page with a green bar showing it is running, today 5 of 5, cards for 5 jobs in production, 0 needing review, 14 done, and a list of 5 articles that passed all 10 steps waiting for their 09:00 to 18:00 slots
The pipeline at midnight — it filled the day's quota of topics on its own, and all 5 passed every step and are waiting for their slots
Job detail drawer with the step timeline: research found 19 facts, topic score 22 of 25, article written at 8,829 characters, fact-check fixed 1 spot, grade A at 89 of 100 with the 5 criteria scores, and a cover plus 3 inline images
Every step explains itself in plain language — this job had 1 sentence fixed by the fact-check, then scored A at 89/100, so it could publish on its own
Quality gate

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.

GradeScoreWhat the system does
A auto85–100Makes images, schedules, publishes, notifies Telegram
B70–84Saved as a draft in the “Needs review” tab with suggested fixes — a person can publish it
C / D< 70Same 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.

Alerts

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.

System status box with 11 items, two marked orange: nothing queued for tomorrow yet, and the AI text model is out of credit, with the fix and a note that it already switched to Gemini. Everything else is normal
The first AI provider ran out of credit overnight — the system switched to the second one by itself, every article still went out, and Telegram explained the fix
1

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.

2

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.

3

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.

4

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.


SEO · Sharing

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.
Audit page: 26 pages checked, 0 must-fix, 0 should-fix, 25 pages fully passing, and the auto-optimize card enabled every 2 weeks with the fix-without-asking switch turned off
All 26 pages checked, nothing to fix — the automatic run is set to audit only, so a person confirms before AI changes anything already live

Test · Real bugs

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.

Fix: set 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.
November calendar where the 20th to 22nd have articles at 18:15, 20:30, 22:45 and 01:00, outside the configured 09:00 to 18:00 window; the summary on the right shows the configured 09:00 to 18:00 window
The evidence is in the calendar — the 20th–22nd have articles at 18:15, 22:45 and 01:00 even though the window was set to 09:00–18:00

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.

Fix: a one-row “lease” in the settings table — the pod holding it renews it on every check; if it dies, another pod takes over once the 3-minute lease expires, and if the database can't answer, a pod assumes it is “not the leader”, because doing nothing is safer than doing it twice.

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.

Fix: every file the system stores is WebP, which has its size in the header — request only the first 64 bytes with an HTTP Range (the CDN answers 206), read width×height from the VP8/VP8L/VP8X chunk and cache it, since file names are hashes that never change. No article edits, no new dependency, 14/14 fixed.

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.

How it was verified: built before and after and diffed all 37 HTML files so only the intended spots differ, the same 116 tests still pass, Playwright 36/36 on both uat and prod — 3 dependencies and 5 vendor scripts removed. The changes not worth the risk (upgrading to Express 5, switching modals to <dialog>) were skipped with the reasons written down

Results

Numbers from the live system

5
articles a day, published on schedule
10
pipeline steps, 4 of them gated
A
minimum grade to auto-publish (≥ 85/100)
5 min
health-check interval → Telegram
Learn

What I learned

The best gate sits right before the expensive step

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.

Alerts belong where people already look

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.

Keep a person at the wheel until the AI earns trust

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

Tan · Natpakan Sirirat

Product Designer & AI Builder — designing user experiences and building AI tools that actually work.

0%