pedro@portfolio ~ % open ./projects/newsfeed
AirHelp Newsfeed
An AI pipeline that turns flight-disruption news into published, multilingual articles.
- role
- Lead engineer · architecture, backend, LLMOps, admin UI
- year
- 2026
- status
- In production since Oct 2026
500+
commits
20+
queue jobs
10+
prompts in Langfuse
70+
architecture decisions
~ % cat README.md
Overview
Newsfeed reads Google News for flight disruptions, then uses LLMs to filter, de-duplicate and rank the stories, summarise each source and write an SEO article. Editors review the drafts in Slack and in an admin dashboard; approved articles are published to the airhelp.com flight-disruptions hub via Storyblok and shared to X and Facebook.
I was technical lead and main engineer. I wrote the go/no-go analysis and a phased migration plan, then moved the 100+ node n8n workflow to a production TypeScript service one pipeline at a time (a strangler pattern, run in parallel with n8n before each cut-over) — recorded in 70+ numbered architecture decisions and per-pipeline specs. The n8n workflows were switched off once the service went live.
Later I replaced the editors’ spreadsheet with Postgres and a React admin dashboard, and redesigned prompts and models to move the pipeline onto newer, cheaper LLMs without losing quality.
~ % ls ./features
What it does
Daily news → article pipeline
A CronJob ingests and ranks the day’s news, then queues one idempotent job per article (summarise → write → save) and a finaliser that posts the review to Slack — so a deploy or crash loses at most one article.
Slack-native editorial flow
Slash-commands and mentions to write an article from any URL or rewrite a row, with signed-request verification before anything is queued.
Prompt management with Langfuse
Prompts are fetched by label at call time — a prompt change needs no deploy — promoted from staging to production, and mirrored into the repo for code review.
Evals before every prompt promotion
Regression datasets for relevance, dedupe, priority, eligibility and article quality run as Langfuse experiments comparing staging vs production.
Cost & model analysis
Scripts read every traced call from Langfuse and report tokens, tool calls and real cost per prompt, then compare cheaper models under a spending cap.
Admin dashboard
React dashboard behind Auth0 roles: review queue with rejection reasons, run history, cost per session, auto-publishing gated by a quality scorecard, traffic and claims attribution per article, and an editable review rota.
Social & CRM distribution
Auto-posting to X and Facebook, a Bloomreach catalog sync for CRM emails and a weekly report of unpublished articles.
Article lifecycle & SEO
Old articles are retired automatically (redirect → unpublish → delete); article templates ship schema markup and an AI disclaimer.
Cross-repo delivery
Shipped across five repositories: the service itself; hub and article templates in the website app (rich text, AI disclaimer, hub redirects for retired articles); retired-article redirects wired into the redirects service; Terraform in the infrastructure repo (queue, IAM, RDS, AI-gateway limits); and Helm values, CronJobs and staging-to-production rollouts in the Kubernetes deployment config repo.
Grounded, validated output
Every model response is checked against a Zod schema, and a summary only counts if it came from the real source page — otherwise the server fetches the page itself or skips the item with a reason.
Auto-publish
An assessment job (rules, a 72-hour duplicate check, AI duplicate and publish checks) publishes articles that pass, with take-down and reporting jobs behind it; trialled in shadow mode before launch.
~ % git log --author=pedro --initiatives
Initiatives I drove
Go/no-go study
Sep 2026Author
- +Mapped every workflow, integration and credential, proposed the target architecture and mapped each n8n capability to an infrastructure equivalent.
- +Found a live data-correctness bug where the publish loop could delete the wrong row, and recommended GO with a strangler pattern: smallest workflow first, every phase revertible.
Migration to a TypeScript service
Sep – Oct 2026Lead engineer
- +One Docker image with worker, cron and web (Hono) entrypoints; one SQS queue plus a dead-letter queue with per-article messages; Terraform infrastructure.
- +All LLM traffic through the company AI gateway with per-pipeline cost tags; prompts moved to Langfuse; n8n decommissioned after cut-over.
Model evaluation & prompt redesign
Oct 2026Engineer
- +Replayed real production inputs against newer models, measured cost, latency and agreement, and picked a model per prompt.
- +About 80% lower daily LLM cost and articles in ~45 seconds instead of ~2 minutes, with no mislabelled compensation articles on the replayed days.
Admin dashboard
Oct 2026Designer & engineer
- +RFC and a one-day working prototype on real data, then Postgres (Prisma), a React dashboard with SSO and roles, a review queue with a rich-text editor, runs, prompts and cost pages.
- +Switch day replaced the editors’ spreadsheet, kept read-only as a rollback mirror.
Auto-publishing with guardrails
Nov 2026Designer & engineer
- +Deterministic checks plus LLM duplicate and publish checks, validated on ~400 historical articles, rolled out in shadow mode, then on with a daily limit.
- +Review after publishing: take-downs unpublish, redirect and delete social posts, and rejection reasons feed a weekly learning loop.
~ % cat CHANGELOG.md
Highlights
- ▸Event-driven workers on AWS SQS with a dead-letter queue, several jobs per pod and graceful shutdown that hands running jobs back.
- ▸Every model call traced with OpenTelemetry into Langfuse; every failure reported in one place (Sentry, logs, Slack alerts).
- ▸Safe data migration: Postgres ran as a read-only shadow beside the Google Sheet, with a sync of editors’ edits and a daily drift report, before switch day made it the record.
- ▸Side effects never retry blindly: failed jobs alert and acknowledge, and social posts use claim-then-verify plus an advisory lock so duplicate webhooks don’t double-post.
- ▸Storyblok rate limits handled with pacing, 429 backoff, requeue with jitter and grouped alerts.
- ▸Owned the infrastructure end to end — Terraform for SQS, IAM, RDS and AI-gateway budgets; Helm values with a migration job per deploy, seven Kubernetes CronJobs and queue-depth autoscaling (0-5 worker pods).
~ % ls ./screenshots
Gallery
next › ./projects/n8n-news
Flight Disruption News Automation (n8n)