Skip to content

Repository files navigation

ViralLab - AI-Powered YouTube Content Creation Platform

React 19 FastAPI Python 3.11 PostgreSQL Docker

ViralLab is a full-stack AI-powered platform that helps YouTube creators generate viral content. From scripts to thumbnails to voiceovers - all powered by GPT-4 and Google Gemini.


✨ Features

🎬 Content Generation

Feature Description
Script Generation AI analyzes viral YouTube videos and generates optimized scripts for any topic
Thumbnail Studio Generate eye-catching thumbnails with AI (Google Gemini)
Face Integration Upload your face and have it seamlessly integrated into thumbnails
Neural Audio Professional text-to-speech voiceovers with multiple voices and personas
Image Generation Generate any image from a text prompt with optional face integration

πŸ”„ Workflow Features

Feature Description
One-Click Workflow Generate script + thumbnails + audio in a single request
Real-time Streaming Server-Sent Events (SSE) for live progress updates
Background Processing Generate content while you work on other things
Multi-model Support GPT-4, GPT-3.5, Gemini Pro, and more

πŸ” Security & Storage

Feature Description
JWT Authentication Secure user authentication with access/refresh tokens
Session Management Multi-device login with session tracking
CloudFlare R2 Storage Optional cloud storage for generated media
Local Storage Mode Works offline with local file storage

πŸ› οΈ Tech Stack

Backend

Technology Purpose
FastAPI High-performance async Python web framework
PostgreSQL Primary database with async support (asyncpg)
SQLAlchemy 2.0 Async ORM for database operations
Alembic Database migrations
LangChain AI/LLM orchestration framework
OpenAI GPT-4 Script generation and text processing
Google Gemini Image/thumbnail generation
Pydantic Data validation and settings management
python-jose JWT token handling
bcrypt Password hashing
boto3 CloudFlare R2 / S3 storage client

Frontend

Technology Purpose
React 19 Modern React with concurrent features
TypeScript Type-safe JavaScript
Vite 7 Fast build tool and dev server
Tailwind CSS 4 Utility-first styling
Framer Motion Smooth animations
React Router 7 Client-side routing
Lucide React Beautiful icon library

Infrastructure

Technology Purpose
Docker Containerization
Docker Compose Multi-container orchestration
CloudFlare R2 S3-compatible object storage
PostgreSQL 16 Production database

πŸ“ Project Structure

youtuber/
β”œβ”€β”€ backend/                    # FastAPI Backend
β”‚   β”œβ”€β”€ alembic/               # Database migrations
β”‚   β”œβ”€β”€ core/                  # Core configuration
β”‚   β”‚   β”œβ”€β”€ config.py          # App settings & env vars
β”‚   β”‚   β”œβ”€β”€ database.py        # Async database setup
β”‚   β”‚   β”œβ”€β”€ dependencies.py    # FastAPI dependencies
β”‚   β”‚   └── security.py        # JWT & password utils
β”‚   β”œβ”€β”€ models/                # Data models
β”‚   β”‚   β”œβ”€β”€ db_models.py       # SQLAlchemy models
β”‚   β”‚   └── schemas.py         # Pydantic schemas
β”‚   β”œβ”€β”€ routers/               # API endpoints
β”‚   β”‚   β”œβ”€β”€ auth.py            # Authentication routes
β”‚   β”‚   β”œβ”€β”€ audio.py           # Audio generation
β”‚   β”‚   β”œβ”€β”€ face.py            # Face upload/management
β”‚   β”‚   β”œβ”€β”€ image.py           # Image generation
β”‚   β”‚   β”œβ”€β”€ script.py          # Script generation
β”‚   β”‚   β”œβ”€β”€ thumbnail.py       # Thumbnail generation
β”‚   β”‚   β”œβ”€β”€ workflow.py        # Full workflow orchestration
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ services/              # Business logic
β”‚   β”‚   β”œβ”€β”€ auth_service.py    # Authentication logic
β”‚   β”‚   β”œβ”€β”€ storage_service.py # R2/local storage
β”‚   β”‚   β”œβ”€β”€ workflow_service.py # Workflow orchestration
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ tests/                 # Backend tests
β”‚   └── main.py               # FastAPI app entry point
β”‚
β”œβ”€β”€ frontend/                  # React Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/              # API client functions
β”‚   β”‚   β”œβ”€β”€ components/       # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/           # Reusable UI components
β”‚   β”‚   β”‚   └── CrystalDock.tsx # Navigation dock
β”‚   β”‚   β”œβ”€β”€ context/          # React contexts
β”‚   β”‚   β”‚   └── AuthContext.tsx # Authentication state
β”‚   β”‚   β”œβ”€β”€ hooks/            # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ pages/            # Route pages
β”‚   β”‚   β”‚   β”œβ”€β”€ WorkflowPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ThumbnailStudioPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ImageStudioPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AudioStudioPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LoginPage.tsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ types/            # TypeScript types
β”‚   β”‚   β”œβ”€β”€ App.tsx           # Landing page
β”‚   β”‚   └── Dashboard.tsx     # Main dashboard
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.ts
β”‚
β”œβ”€β”€ src/                       # Core Python Services
β”‚   β”œβ”€β”€ script_generator.py    # AI script generation
β”‚   β”œβ”€β”€ thumbnail_generator.py # Gemini thumbnail generation
β”‚   β”œβ”€β”€ thumbnail_analyzer.py  # Reference image analysis
β”‚   β”œβ”€β”€ audio_genreator.py     # OpenAI TTS audio
β”‚   β”œβ”€β”€ video_fetcher.py       # YouTube video fetching
β”‚   └── transcript_scraper.py  # Video transcript extraction
β”‚
β”œβ”€β”€ docker-compose.yml         # Docker orchestration
β”œβ”€β”€ Dockerfile                 # Production image
β”œβ”€β”€ Dockerfile.dev             # Development image
└── requirements.txt           # Python dependencies

πŸš€ Getting Started

Prerequisites

  • Python 3.11+
  • Node.js 20+
  • PostgreSQL 16+ (or Docker)
  • API Keys:
    • OpenAI API Key (for scripts & audio)
    • Google Gemini API Key (for thumbnails & images)

Quick Start with Docker

# 1. Clone the repository
git clone https://github.com/yourusername/youtuber.git
cd youtuber

# 2. Copy environment file and add your API keys
cp .env.example .env
# Edit .env with your API keys

# 3. Start with Docker Compose
docker compose up --build

# App will be available at http://localhost:8001

Local Development

# Backend Setup
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows
pip install -r requirements.txt

# Start PostgreSQL (or use Docker)
docker compose up db -d

# Run migrations
cd backend && alembic upgrade head

# Start backend
uvicorn backend.main:app --reload --port 8001

# Frontend Setup (new terminal)
cd frontend
npm install
npm run dev

# Frontend at http://localhost:5173
# Backend at http://localhost:8001

πŸ”‘ Environment Variables

# API Keys (Required)
OPENAI_API_KEY=sk-your-openai-key
GEMINI_API_KEY=your-gemini-key

# Database
DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/youtuber

# JWT Security
JWT_SECRET_KEY=your-super-secret-key-change-in-production

# Optional: CloudFlare R2 Storage
STORAGE_MODE=local  # or "r2"
R2_ACCOUNT_ID=
R2_ACCESS_KEY_ID=
R2_SECRET_ACCESS_KEY=
R2_BUCKET_NAME=virallab-media
R2_PUBLIC_URL=

πŸ“‘ API Endpoints

Authentication

Method Endpoint Description
POST /auth/signup Register new user
POST /auth/login Login and get tokens
POST /auth/refresh Refresh access token
POST /auth/logout Logout current device
GET /auth/me Get current user info
GET /auth/sessions List active sessions

Content Generation

Method Endpoint Description
POST /generate/script Generate YouTube script
POST /generate/thumbnail Generate thumbnails
POST /generate/full-workflow Script + thumbnails in one call
POST /generate/full-workflow/stream Streaming workflow with SSE

Audio

Method Endpoint Description
GET /audio/options Get available voices & personas
POST /audio/generate Generate voiceover audio
GET /audio/list List user's audio files

Images

Method Endpoint Description
POST /image/generate Generate images from prompt
GET /image/list List user's generated images

Face Management

Method Endpoint Description
POST /face/upload Upload face image
GET /face/current Get current face image
DELETE /face/current Delete face image

🎨 Frontend Pages

Page Path Description
Landing / Marketing landing page
Login /login User authentication
Signup /signup New user registration
Dashboard /dashboard Main app dashboard
Workflow /dashboard/workflow Full content workflow
Thumbnail Studio /dashboard/thumbnail Generate thumbnails
Image Studio /dashboard/image Generate images
Audio Studio /dashboard/audio Generate voiceovers
Settings /dashboard/settings User settings

🐳 Docker Commands

# Production build & run
docker compose up --build

# Development mode (with hot reload)
docker compose --profile dev up db frontend-dev backend-dev

# Just the database
docker compose up db

# View logs
docker compose logs -f app

# Stop all services
docker compose down

# Clean volumes
docker compose down -v

πŸ§ͺ Testing

# Run backend tests
cd backend
pytest

# Run with coverage
pytest --cov=backend

# Run specific test file
pytest tests/test_auth.py -v

πŸ“„ License

MIT License - feel free to use this project for personal or commercial purposes.


🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Built with ❀️ by Aditya Pratap Singh

About

Full-stack AI platform for YouTube creators. Generate scripts, thumbnails with face cloning, and voiceovers using GPT-4 & Gemini. React 19 + FastAPI + PostgreSQL.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages