Skip to content
All projects

case study / content-automation

Content Automation Pipeline

A cloud-hosted n8n workflow that researches, writes, narrates, and files a day's content before 7 AM. Fully autonomous, and safe to fail.

Role
Personal engineering project. Designed, built, deployed, and operated end to end
Context
n8n · Railway · Google Gemini · 6 orchestrated APIs
Timeframe
2026 · Active, runs daily
workflow nodes
15
workflow nodes
daily schedule trigger
6 AM
daily schedule trigger
saved every day
~2 hrs
saved every day
manual steps per run
0
manual steps per run

01 / problem

The problem

Making short-form content every day was eating my mornings. Over an hour, every day, on the same sequence: search Reddit for trending topics, pick one, write a script, hunt for copyright-free footage, record audio, sort everything into folders.

Repetition on a fixed schedule is exactly what machines are for.

02 / approach

Motivation

Saving the hour was only half the point. I also wanted to learn workflow orchestration properly: how n8n composes services, and what it actually takes to run an unattended AI pipeline you can trust.

So I set a bar. It runs every morning whether or not my laptop is on. It never fails silently. And I can reconstruct any run from its logs.

03 / architecture

Architecture

A schedule trigger fires at 6 AM and drives fifteen nodes: fetch trending Reddit topics, choose one, generate a script with Gemini Flash, clean the output, then hit a validation gate. A valid script flows on to Pexels for stock video, narration generation, Google Drive for storage, a log row in Google Sheets, and a summary email to me. An invalid script takes the failure branch instead: an error email, then a safe stop.

The whole thing runs on Railway using the official n8n template backed by PostgreSQL, so execution history survives redeploys and credentials live in managed environment variables. None of it depends on my hardware.

The real workflow: 15 nodes on n8n, deployed on Railway. The lower branch is the failure path (script check → error report email → safe stop). Click to enlarge.

What it does on its own

  • Scheduled + manual runs

    6 AM cron trigger; on-demand execution when needed

  • Fails loudly, stops safely

    Script validation gate → error email → clean stop

  • Assets filed automatically

    Scripts, narration, and footage organised in Drive

  • Every run logged

    Timestamp, execution ID, topic, status, errors → Sheets

  • Inbox observability

    Success summaries and failure alerts by email

  • Cloud-native

    Railway + PostgreSQL — runs with the laptop off

Six APIs, one chain

  • Reddittrend discovery
  • Geminiscript generation
  • Pexelsstock footage
  • Google Driveasset storage
  • Google Sheetsexecution log
  • Gmailsummaries & alerts

04 / decisions

Engineering decisions

  1. 01

    Validate before spending

    The validation gate sits immediately after script generation, before any video downloads, narration, or storage. A malformed script stops the run at the cheapest possible point instead of producing a folder of garbage assets.

  2. 02

    A cleaning stage between the model and everything else

    Gemini's output varied in structure from run to run. A dedicated cleaning node standardises the script before downstream nodes touch it, so every later stage can assume one format. Never feed raw model output to machinery.

  3. 03

    Cloud-hosted, not laptop-hosted

    An automation that needs my laptop switched on isn't really autonomous. Hosting on Railway means the 6 AM run happens wherever I am, and PostgreSQL keeps the execution history through redeploys.

  4. 04

    Observability built in from the start

    Every run writes a row to Google Sheets with the timestamp, execution ID, chosen topic, status, and any errors. Between the success emails and the failure alerts, I never have to wonder whether it ran.

05 / challenges

What was hard

problemGenerated scripts varied a lot in structure and quality between runs.

solutionTightened the prompt and added the cleaning stage, so the variation gets absorbed before it can break anything downstream.

problemNarration sounded robotic rather than natural.

solutionTried different TTS providers and played with prompt formatting (pacing, punctuation, phrasing cues) until the voice was usable.

06 / outcome

Results

The pipeline now runs every morning with zero manual steps. Scripts, narration, and stock footage get produced automatically, assets land organised in Google Drive, every execution is tracked in Sheets, and there's a summary email waiting when I wake up. That's roughly two hours back, daily.

The learning mattered as much as the hours. Chaining six APIs, prompt engineering for output a machine has to consume, and designing error handling for a system nobody is watching taught me more about automation than any tutorial could.

Demo — one full run

The workflow executing end to end inside the n8n editor on Railway.

Next on the roadmap

  • Automatic YouTube uploads
  • ElevenLabs narration
  • CapCut automation
  • Analytics dashboard
  • Multiple content niches

An unattended system is only as good as its failure paths. What makes this one autonomous isn't the schedule trigger. It's the validation gate, the alerts, and the log.

Stack

n8nRailwayPostgreSQLGemini FlashReddit APIPexels APIGmail APIGoogle Drive APIGoogle Sheets API