
Video Factory: AI-Powered Video Creation Pipeline
Submit an idea, watch AI generate transcript, audio, images, subtitles, waveforms, and final video, then publish directly to YouTube.
Overview
Video Factory is an authenticated AI video creation platform that turns a simple idea into a fully produced video. Users sign in with Google, submit a concept through a quick form or a detailed multi-step wizard, and an asynchronous Cloud Run pipeline handles the rest, generating transcript, audio, images, subtitles, waveforms, and the final composited video.
Beyond creation, Video Factory integrates YouTube channel management, letting users upload finished videos directly. With a content calendar, AI-driven topic suggestions, analytics dashboards, and full internationalization across 18 locales, it covers the entire video production lifecycle from idea to publication.
Key Features
How It Works
Users authenticate through Google OAuth and complete a short profile with their preferred language. From the dashboard, they can submit a video idea via the quick form or the multi-step wizard. The wizard provides fine-grained control: editing the AI-generated transcript, choosing a voice, setting image count and resolution, enabling subtitles and waveforms, and optionally targeting a YouTube channel for upload.
On submission, the API creates a Prisma job record and triggers an asynchronous Cloud Run pipeline. The pipeline runs a 7-stage task graph: transcript generation, audio generation, image prompt generation, image generation, waveform generation, subtitle generation, and final video compositing. Each stage builds on the outputs of the previous one, with configurable task inclusion and exclusion depending on the user's selections.
Back on the client, a polling mechanism checks job status every 10 seconds while any job is active. Once complete, the final video is served through a signed Google Cloud Storage URL with a 1-hour expiry. Users can then play the video directly in the browser using Video.js or upload it to a connected YouTube channel.
Challenges & Solutions
Triggering the video pipeline without blocking the API response.
Used Next.js after() to schedule the Cloud Run trigger after the response is sent. Pipeline failures are logged but don't fail the API call, keeping the UX responsive.
Securing YouTube OAuth tokens while enabling server-side uploads.
Access and refresh tokens are stored exclusively in the Channel database model and never sent to the client. A dedicated SerializedChannel type strips tokens before any client-facing response.
Serving video files without exposing the storage bucket.
Videos are served through signed GCS URLs that expire after one hour, keeping the bucket private while allowing temporary playback access.
Maintaining consistent translations across 18 locales including RTL support.
Enforced identical key structures across all locale files and used logical CSS utilities (start/end, ms/me) over physical left/right to support Arabic RTL layout natively.
Preventing users from accessing other users' video jobs.
Replaced bare findUnique lookups with findFirst constrained by createdBy: session.user.id, ensuring strict ownership checks on every job-related API route.
Outcome
Video Factory automates the entire video production pipeline, from idea to finished, publishable content. By combining AI-powered generation with a 7-stage Cloud Run pipeline, YouTube integration, content scheduling, and analytics, it gives creators a complete platform to go from concept to audience without switching tools.
The app is live and actively used, with ongoing improvements to pipeline capabilities, E2E test coverage, and admin tooling.