Viralaiugc
No description available
Install / Use
/learn @rish9600/ViralaiugcREADME
Viral AI UGC Setup Documentation
GitHub link: https://github.com/rish9600/viralaiugc
Assets link: https://drive.google.com/drive/folders/1UsaV1nXoU672Ung-IEzENOaUMyW4wRR3?usp=drive_link
Viral AI UGC is an AI UGC content tool for TikTok. Frontend and DB are completely vibe-coded with Lovable. The tech stack includes Vite (React) for the frontend, Supabase for the database, Vercel for hosting, and a Node.js server that runs locally to render videos at no cost. You can use everything on the free tier of each service. T he entire project was built in just 48 hours spread across one week. Feel free to use it, and don't hesitate to reach out if you encounter any issues.
Overview
This documentation provides step-by-step instructions for self-hosting the Viral AI UGC platform. The setup process consists of four main components:
- Supabase (Database)
- Vercel (Frontend)
- Backend Server
- Google Cloud Console (Authentication)
Total estimated setup time: 30 minutes
Table of Contents
- Prerequisites
- Step 1: Supabase Setup
- Step 2: Vercel Frontend Deployment
- Step 3: Backend Server Configuration
- Step 4: Authentication Setup
- Troubleshooting
- Additional Resources
Prerequisites
- GitHub account
- Vercel account
- Google Cloud Console account
- Basic understanding of terminal/command line
- Node.js and npm installed locally
Image is clicable and redirects you to video documentation of the project: https://www.youtube.com/watch?v=lUQMGl2ZjgU (6.35 mins)
Step 1: Supabase Setup
-
Create a new Supabase project
- Navigate to Supabase
- Sign in or create an account
- If this is your first time using Supabase, you'll be prompted to create an organization
- Click "New Project"
-
Configure your project
- Enter a name for your project
- Create a strong database password and store it securely
- Select the region closest to your target audience for optimal performance
- Click "Create Project"
-
Initialize database schema
- In the left navigation panel, click "SQL Editor"
- Paste the SQL schema provided
-- Enum Types create type plan as enum ('free', 'pro', 'ultra'); create type template_type as enum ('aiavatar', 'game', 'usergenerated'); create type text_alignment as enum ('top', 'center', 'bottom'); create type video_alignment as enum ('side', 'top', 'serial'); create type video_type as enum ('aiugc', 'meme'); -- Create Tables -- PLANS TABLE create table public.profiles ( id uuid not null, username text null, avatar_url text null, created_at timestamp with time zone not null default now(), updated_at timestamp with time zone not null default now(), plan public.plan not null default 'free'::plan, credits integer not null default 3, email text null, constraint profiles_pkey primary key (id), constraint profiles_id_fkey foreign KEY (id) references auth.users (id) on delete CASCADE ); -- Set up Row Level Security (RLS) alter table public.profiles enable row level security; create policy "Users can update their own profile" on public.profiles for update to public using (auth.uid() = id); create policy "Users can view their own profile" on public.profiles for select to public using (auth.uid() = id); create policy "Users can delete their own profile" on public.profiles for delete to public using (auth.uid() = id); -- DEMO TABLE create table public.demo ( id bigint generated by default as identity not null, created_at timestamp with time zone not null default now(), demo_link text not null, user_id uuid not null, constraint demo_pkey primary key (id), constraint demo_user_id_fkey foreign KEY (user_id) references profiles (id) on delete CASCADE ); -- Set up Row Level Security (RLS) alter table public.demo enable row level security; create policy "Allow users to insert their own demos" on public.demo for insert to authenticated with check (user_id = auth.uid()); create policy "Users can update their own demos" on public.demo for update to public using (auth.uid() = user_id); create policy "Allow users to view their own demos" on public.demo for select to authenticated using (user_id = auth.uid()); create policy "Allow users to delete their own demos" on public.demo for delete to authenticated using (user_id = auth.uid()); -- GENERATED IMAGES TABLE create table public.generated_images ( id bigint generated by default as identity not null, created_at timestamp with time zone not null default now(), user_id uuid null default gen_random_uuid (), video_url text null, prompt text null, constraint generated_images_pkey primary key (id), constraint generated_images_user_id_fkey foreign KEY (user_id) references auth.users (id) on delete CASCADE ); -- Set up Row Level Security (RLS) alter table public.generated_images enable row level security; create policy "Users can insert their own generated images" on public.generated_images for insert to public with check (user_id = auth.uid()); create policy "Users can update their own generated images" on public.generated_images for update to public using (auth.uid() = user_id); create policy "Users can view their own generated images" on public.generated_images for select to public using (user_id = auth.uid()); create policy "Users can delete their own generated images" on public.generated_images for delete to public using (user_id = auth.uid()); -- SOUNDS TABLE create table public.sound ( id bigint generated by default as identity not null, created_at timestamp with time zone not null default now(), sound_link text not null, name text not null default 'audio name'::text, user_id uuid null, constraint sound_pkey primary key (id), constraint sound_user_id_fkey foreign KEY (user_id) references auth.users (id) on delete CASCADE ); -- Set up Row Level Security (RLS) alter table public.sound enable row level security; create policy "Users can insert their own sounds" on public.sound for insert to public with check (auth.uid() = user_id); create policy "Users can update their own sounds" on public.sound for update to public using (auth.uid() = user_id); create policy "Users can view sounds with null user_id or their own" on public.sound for select to public using ((user_id IS NULL) OR (auth.uid() = user_id)); create policy "Users can delete their own sounds" on public.sound for delete to public using (auth.uid() = user_id); -- TEMPLATES TABLE create table public.templates ( id bigint generated by default as identity not null, created_at timestamp with time zone not null default now(), video_link text not null, image_link text null, template_type public.template_type null default 'aiavatar'::template_type, user_id uuid null, constraint templates_pkey primary key (id), constraint templates_user_id_fkey foreign KEY (user_id) references auth.users (id) on delete CASCADE ); -- Set up Row Level Security (RLS) alter table public.templates enable row level security; create policy "Users can insert their own templates" on public.templates for insert to public with check (user_id = auth.uid()); create policy "Users can update their own templates" on public.templates for update to public using (auth.uid() = user_id); create policy "Templates visible publicly" on public.templates for select to public using (true); create policy "Users can delete their own templates" on public.templates for delete to public using (user_id = auth.uid()); -- GENERATED VIDEOS TABLE create table public.generated_videos ( id uuid not null default gen_random_uuid (), created_at timestamp with time zone not null default now(), text_alignment public.text_alignment not null, video_alignment public.video_alignment null, video_type public.video_type not null, user_id uuid not null, demo_id bigint null, sound_id bigint null, template_id bigint null, remotion jsonb null, remotion_video text null, status text not null default 'pending'::text, error text null, caption text null, completed_at timestamp with time zone null, constraint generated_videos_pkey primary key (id), constraint generated_videos_demo_id_fkey foreign KEY (demo_id) references demo (id) on delete set null, constraint generated_videos_sound_id_fkey foreign KEY (sound_id) references sound (id) on delete set null, constraint generated_videos_template_id_fkey foreign KEY (template_id) references templates (id) on delete set null, constraint generated_videos_user_id_fkey foreign KEY (user_id) references profiles (id) on delete CASCADE ); -- Set up Row Level Security (RLS) alter table public.generated_videos enable row level security; create policy "Users can insert their own generated videos" on public.generated_videos for insert to public with check (user_id = auth.uid()); create policy "Users can update their own generated videos" on public.generated_videos for update to public using (auth.uid() = user_id); create policy "Users can view their own generated videos" on public.generated_videos

