Skip to content
Rebin Youssef
Rebin Youssef
Download CV (PDF, English)Svenska
Appearance

AutopilotReels

Configure a series once, and a durable job system takes each episode from story research to a checked, published short video, with a hard cap on what any episode may cost.

Status
Running privately on a small server. Publishes through the official YouTube and Instagram APIs.
My role
Solo, with an AI-assisted engineering workflow
Timeline
2026, in use
Stack
Next.js 15, React 19, TypeScript, Prisma, PostgreSQL, pg-boss, FFmpeg, Zod, Vitest
AutopilotReels control center: autopilot running, one video ready to publish, next publication and production run, paid generation off

Overview

AutopilotReels is a single-operator web app and a long-running worker. The operator sets up a series once: its topic, visual style, voice, captions, publishing accounts and schedule. From then on the system creates one video per slot, checks it, and publishes it when the slot comes round.

Problem

Making short-form video by hand is a long chain of repetitive steps: find a story, check it, write it, draw it, voice it, caption it, cut it, check it, upload it twice. Every step can fail, and AI services cost money every time they are called.

Goals

  • Every step resumable after a crash or restart
  • Never spend money by accident
  • Nothing published that failed a quality check
  • Never publish the same video twice

Solution

A state machine moves each video through discovery, research, script, storyboard, images, voice, captions, render, quality check and packaging. Each step is one job on a PostgreSQL-backed queue; it is retried a bounded number of times and otherwise blocked with a stored reason. Publishing then runs per platform, so one platform can succeed while the other is retried.

Core journeys

Series settings with an art-style picker of preview images, Comic selected, plus image provider and animated hook options

Configure a series

Content rules, art style, voice and captions, publishing accounts and the posting schedule, in one settings screen.

Video detail showing all ten production stages completed and a timestamped production history of each pipeline step

Watch the pipeline

The control centre shows what needs attention, progress per video and the next publishing slot. Every step of every attempt is recorded.

Video detail with the locally rendered 9:16 MP4 paused at an animated caption, beside its specs (1080x1920, 36.8s)

Review the package

Each finished video has a 9:16 preview, its frozen configuration and an editor for title, description and tags.

Screens

  • Control center: what runs, what publishes next

  • Ten-stage pipeline with a full production history

  • Rendered 9:16 short with animated captions

  • Series art-style picker drives every video's visuals

  • Publishing calendar by slot and platform

Image 1 of 5

AutopilotReels control center: autopilot running, one video ready to publish, next publication and production run, paid generation off
Control center: what runs, what publishes next

Technology

Next.js 15, React 19, TypeScript, Prisma, PostgreSQL, pg-boss, FFmpeg, Zod, Vitest

Architecture

  1. 1. Web (Next.js)
    • Control centre, series, videos, calendar
    • OAuth connections for YouTube and Instagram
  2. 2. Worker
    • Scheduler tick every minute
    • One pipeline step per job, bounded retries
    • Spend gate and per-video budget
  3. 3. Media
    • FFmpeg render, captions, audio mix
    • Quality checks and targeted repair
  4. 4. Data and services
    • PostgreSQL (Prisma) and pg-boss queue
    • LLM, image, voice and video providers
    • Platform publishing APIs
Two processes from one codebase. All AI providers sit behind one switch with deterministic fakes as the default. Drawn from the source code.

Engineering decisions

A queue in the database, not a separate broker

pg-boss on PostgreSQL gives durable jobs, retries with backoff and cron scheduling without adding Redis. Each job advances one step and re-enqueues, so a restart never loses progress.

Spending is opt-in and capped

Real AI calls refuse to run unless paid generation is explicitly enabled, and a per-video budget refuses any call that would cross the cap before it is sent. The test setup forces the gate off and strips every real credential.

Idempotency in the schema

Unique constraints on series and slot, and on video and platform, make duplicate scheduling and double publishing impossible even when two processes race.

Check, then repair what failed

Quality checks fail by category and trigger targeted repairs, and the failure reasons are fed back into the next attempt instead of blindly regenerating.

Challenges and solutions

Scheduled uploads failing in production

Uploads began failing with authorisation errors because access tokens were never refreshed before use. I traced the root cause, made every publish attempt refresh the token first, added a regression test and ran exactly one recovery upload per channel.

Images with unreadable text

Generated images sometimes contained garbled lettering. A local OCR check with Tesseract now rejects images that contain readable text; titles are composed separately with FFmpeg on text-free art.

Technical highlights

  • 1080×1920 H.264 render with Ken Burns motion and crossfades
  • Burned-in captions fitted to word timings from the voice track
  • Music ducked under the voice and loudness normalised in two passes to −14 LUFS
  • Timezone- and daylight-saving-aware scheduling with automatic retry rounds
  • Email alerts when a slot can’t be filled or a publication is blocked

Security, accessibility, testing and deployment

Security

OAuth tokens are encrypted at rest, the operator signs in with a single account, and media is served only through authenticated routes.

Testing

About 1,100 Vitest tests across more than a hundred test files, some running against a real database. The project’s own log records 1,122 of 1,123 passing on the latest branch, with the single failure documented as pre-existing. I have not re-run the suite for this portfolio.

Deployment

Runs as two systemd services on a small private server, with PostgreSQL in a container and daily backups. The web interface is not public.

My contribution

Solo automation project developed through an AI-assisted engineering workflow. My contribution covers product requirements, architecture decisions, workflow orchestration, implementation review, testing, operational safeguards and system operation.

Links

The repository is private. I’m happy to walk through the code in an interview.

Next project

Wedding Memories

A custom-built private photo and video sharing application developed for a wedding.

← All projects