An AI-powered platform for generating viral short-form videos (YouTube Shorts, TikTok) automatically. Simply describe your topic, and the platform handles script writing, voice generation, image creation, and video composition.
- AI Script Generation - Uses Google Gemini to create engaging, viral-worthy scripts
- Text-to-Speech - Deepgram integration for natural voice generation in multiple languages
- AI Image Generation - Creates matching visuals using Replicate with Cloudflare Workers fallback
- Automatic Captions - Deepgram transcription with word-level timing for captions
- Series Management - Create series with customizable parameters (duration, style, language, music)
- User Authentication - Clerk-powered user management
- Background Processing - Inngest for reliable async job handling
- Cloud Storage - Supabase for secure file storage and database
- Next.js 16 - React framework with API routes
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- React Hook Form - Form management
- Zod - Schema validation
- Clerk - User authentication and management
- Supabase - PostgreSQL database and file storage
- Row Level Security (RLS) - Data protection policies
- Google Gemini 2.5 Flash - Script and content generation
- Deepgram API - Text-to-speech and transcription
- Replicate - AI image generation (Imagen 4)
- Cloudflare Workers - Fallback image generation
- Inngest - Workflow orchestration for video generation
- Remotion - Programmatic video composition and MP4 rendering
- Radix UI - Unstyled, accessible components
- Shadcn UI - Pre-built component library
- Lucide Icons - Icon library
- Sonner - Toast notifications
Before you begin, ensure you have:
- Node.js 18+ and npm/yarn
- Git for version control
- Accounts and API Keys:
- Supabase - Database & storage
- Clerk - Authentication
- Google Cloud - Gemini API key
- Deepgram - Speech API
- Replicate - Image generation
- Cloudflare - Workers setup (optional fallback)
- Inngest - Workflow management (optional, for local testing use webhook)
git clone <repository-url>
cd video-generatornpm install
# or
yarn install
# or
pnpm installVisit Supabase and:
- Create a new project
- Copy your
URLandAnon Keyfrom settings - Run the schema migration:
# Using Supabase CLI (install from https://supabase.com/docs/guides/cli)
supabase db push supabase_schema.sqlOr manually paste the contents of supabase_schema.sql into the SQL editor in Supabase dashboard.
Visit Clerk Dashboard:
- Create a new application
- Go to API Keys and copy
Publishable KeyandSecret Key - Set up Sign In and Sign Up URLs in Clerk settings (use
http://localhost:3000for local development)
Copy the template and fill in your credentials:
cp .env.local.example .env.localEdit .env.local with your API keys:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
# Webhook Secret (from Clerk)
WEBHOOK_SECRET=your_webhook_secret
# AI/3rd-party service credentials
GEMINI_API_KEY=your_google_gemini_api_key
DEEPGRAM_API_KEY=your_deepgram_api_key
REPLICATE_API_TOKEN=your_replicate_api_token
# Cloudflare Worker for fallback image generation
CLOUDFLARE_WORKER_URL=your_worker_url
CLOUDFLARE_WORKER_API_KEY=your_worker_api_key
<<<<<<< HEAD
# Inngest (local dev β optional; npm run dev enables dev mode automatically)
# INNGEST_DEV=1
# Production: INNGEST_SIGNING_KEY=your_signing_key
=======
# Inngest (local dev)
INNGEST_DEV=1
>>>>>>> c05b90bf42cf3f69f2af116560fefde49899f479If you have Supabase CLI installed:
npx supabase link --project-ref your_project_ref
npx supabase startnpm run devThe application will be available at http://localhost:3000
Features hot-reload - edit app/page.tsx or any component and see changes instantly.
npm run build
npm startnpm run lintFor local development with background job processing, you must run the Inngest local dev server to handle the long-running AI video generation pipelines.
Run this in a separate terminal alongside your app:
npx inngest-cli@latest devThis will start the Inngest dashboard at http://localhost:8288 where you can monitor and trigger background jobs.
video-generator/
βββ app/
β βββ actions/ # Server actions for data mutations
β βββ api/ # API routes (Deepgram TTS, Inngest, webhooks)
β βββ dashboard/ # Protected dashboard routes
β β βββ create-series/ # Video series creation wizard
β β βββ videos/ # Video list and management
β βββ sign-in/ # Clerk sign-in page
β βββ sign-up/ # Clerk sign-up page
β βββ layout.tsx # Root layout with Clerk provider
β βββ page.tsx # Landing page
β βββ globals.css # Global styles
βββ components/
β βββ dashboard/ # Dashboard UI components
β β βββ wizard/ # Series creation wizard steps
β βββ landing/ # Landing page components
β βββ ui/ # Reusable UI components (from shadcn)
βββ hooks/ # Custom React hooks
βββ lib/
β βββ supabase/ # Supabase client wrappers
β βββ inngest/ # Inngest workflow definitions
β βββ utils.ts # Utility functions
βββ utils/
β βββ supabase/ # Supabase helpers (admin, client, server)
βββ public/
β βββ video-style/ # Video style assets
β βββ voice/ # Voice sample assets by language
βββ middleware.ts # Clerk authentication middleware
βββ supabase_schema.sql # Database schema
βββ .env.local # Environment variables (local)
- User Sign Up - Authenticate via Clerk
- Dashboard - Navigate to "Create Series"
- Series Wizard - Fill out:
- Step 1: Format & niche/topic
- Step 2: Voice & language
- Step 3: Background music
- Step 4: Visual style
- Step 5: Duration & publish schedule
- Series Saved - Series data stored in Supabase
The core technique of this platform relies on an intensive pipelined orchestration via Inngest, sequentially calling specialized API models and then assembling the final layout context via Remotion:
- Trigger Generation - User interacts with the UI, which queues an Inngest background event (
video/generate). - Generative Scripting -
GoogleGenAI(Gemini 2.5 Flash) is prompted with the series context (niche, length, specific requested visual style) and generates a structured JSON payload defining the VoiceOver script and a specific number of high-quality image generation prompts (e.g. 4-6 scenes). - Voice Over Synthesis -
DeepgramAPI converts the script into a high-quality human-sounding.wavTTS file. - Caption Timing Array - Deepgram's text API analyzes the exact audio output to generate a JSON array of timestamped words. These perfectly timed bounds trigger the bouncing, animated kinetic typography during playback.
- Generative Visuals - Scene prompts are concurrently sent to
Replicate(Imagen 4) or yourCloudflare WorkerAPI fallback to generate engaging portrait illustrations. - Programmatic Composition - The generated Audio, timed Captions JSON, array of returned Illustration URLs, chosen background music, and user-select visual overlay configs are fed as configuration props to Remotion. Remotion programmatically computes styling bounds, applies React component logic natively, and statically builds out a high-framerate final rendering of the
.MP4video exactly based on those generated assets. - Asset Sync & DB Store - Final assets (video MP4, raw audio) are synchronized into your Supabase Storage buckets, and the
video_generationspostgres table is updated so the final viral video appears instantly on the user's dashboard!
| Variable | Purpose | Required |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Supabase project URL | Yes |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Public Supabase key | Yes |
SUPABASE_SERVICE_ROLE_KEY |
Admin Supabase key | Yes |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Clerk public key | Yes |
CLERK_SECRET_KEY |
Clerk secret key | Yes |
WEBHOOK_SECRET |
Clerk webhook signing secret | Yes |
GEMINI_API_KEY |
Google Gemini API key | Yes |
DEEPGRAM_API_KEY |
Deepgram API key | Yes |
REPLICATE_API_TOKEN |
Replicate API token | Yes |
CLOUDFLARE_WORKER_URL |
Cloudflare Worker URL | No (fallback) |
CLOUDFLARE_WORKER_API_KEY |
Cloudflare Worker API key | No (fallback) |
Ensure all required variables are set in .env.local. Check that:
- Keys are correctly copied (no trailing spaces)
- URLs don't have extra slashes
- Service role key is the admin key, not the anon key
- Verify
DEEPGRAM_API_KEYis valid - Check Deepgram account has credits
- Ensure voice model names are correct (e.g.,
aura-asteria-en)
- Check
REPLICATE_API_TOKENvalidity - Verify account has credits
- Cloudflare Worker fallback will be used if Replicate fails
- Ensure redirect URLs are configured in Clerk dashboard
- Check that
WEBHOOK_SECRETmatches Clerk dashboard value - Clear browser cookies and try again
- Verify Supabase URL and keys are correct
- Check network connectivity
- Ensure RLS policies are properly set up
- Next.js Documentation
- Supabase Docs
- Clerk Documentation
- Google Gemini API
- Deepgram API
- Replicate API
- Inngest Documentation
MIT License - feel free to use this project for personal or commercial purposes.