Skip to content

AI-driven YouTube video generator that creates viral content automatically - from script to upload in minutes. Modern SaaS platform built with Laravel, Vue.js, n8n and Docker, featuring intelligent automation and seamless YouTube integration.

add the try demo

Mohamed El aassal41345d3aa4bd
diff --git a/app/Http/Controllers/Auth/DemoController.php b/app/Http/Controllers/Auth/DemoController.php
new file mode 100644
index 0000000..7bdfd2c
--- /dev/null
+++ b/app/Http/Controllers/Auth/DemoController.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use App\Models\User;
+use Illuminate\Http\RedirectResponse;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
+
+class DemoController extends Controller
+{
+ public function loginDemo(): RedirectResponse
+ {
+ // Create or find a demo user
+ $user = User::firstOrCreate([
+ 'email' => '[email protected]'
+ ], [
+ 'name' => 'Demo User',
+ 'email' => '[email protected]',
+ 'password' => Hash::make('demo123'),
+ 'email_verified_at' => now(),
+ 'google_id' => null,
+ 'avatar_url' => '/placeholder-user.jpg',
+ ]);
+
+ // Login the demo user
+ Auth::login($user, true);
+
+ return redirect()->route('dashboard')->with('success', 'Welcome to the demo! You are now logged in as a demo user.');
+ }
+}
diff --git a/app/Http/Controllers/Auth/GoogleController.php b/app/Http/Controllers/Auth/GoogleController.php
index 6f839a7..7ea44c5 100644
--- a/app/Http/Controllers/Auth/GoogleController.php
+++ b/app/Http/Controllers/Auth/GoogleController.php
@@ -8,23 +8,19 @@ use App\Models\YoutubeChannel;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Log;
use Laravel\Socialite\Facades\Socialite;
-use Google_Client;
-use Google_Service_YouTube;
class GoogleController extends Controller
{
public function redirect(): RedirectResponse
{
- return Socialite::driver('google')
- ->scopes([
- 'openid',
- 'profile',
- 'email',
- 'https://www.googleapis.com/auth/youtube.upload',
- 'https://www.googleapis.com/auth/youtube.readonly'
- ])
- ->redirect();
+ // Check if Google OAuth is configured
+ if (!config('services.google.client_id') || config('services.google.client_id') === 'your_google_client_id_here') {
+ return redirect('/login')->with('error', 'Google OAuth is not configured. Please set up your Google OAuth credentials in the .env file.');
+ }
+
+ return Socialite::driver('google')->redirect();
}
public function callback(): RedirectResponse
@@ -46,8 +42,8 @@ class GoogleController extends Controller
Auth::login($user);
- // Fetch and store YouTube channel information
- $this->syncYouTubeChannels($user);
+ // TODO: Fetch and store YouTube channel information
+ // $this->syncYouTubeChannels($user);
return redirect()->intended('/dashboard');
@@ -58,6 +54,11 @@ class GoogleController extends Controller
protected function syncYouTubeChannels(User $user): void
{
+ // TODO: Implement YouTube channel sync when Google API client is installed
+ // For now, just log that we would sync channels
+ Log::info('YouTube channel sync would happen here for user: ' . $user->id);
+
+ /*
try {
$client = new Google_Client();
$client->setAccessToken($user->google_access_token);
@@ -81,8 +82,9 @@ class GoogleController extends Controller
}
} catch (\Exception $e) {
// Log error but don't fail the authentication
- \Log::error('Failed to sync YouTube channels: ' . $e->getMessage());
+ Log::error('Failed to sync YouTube channels: ' . $e->getMessage());
}
+ */
}
public function logout(Request $request): RedirectResponse
diff --git a/app/Models/Video.php b/app/Models/Video.php
index e69de29..e941c0a 100644
--- a/app/Models/Video.php
+++ b/app/Models/Video.php
@@ -0,0 +1,79 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+
+class Video extends Model
+{
+ use HasFactory;
+
+ protected $fillable = [
+ 'user_id',
+ 'youtube_channel_id',
+ 'title',
+ 'description',
+ 'topic',
+ 'generated_script',
+ 'scenes',
+ 'pexels_videos',
+ 'voiceover_file_path',
+ 'background_music_path',
+ 'final_video_path',
+ 'thumbnail_path',
+ 'status',
+ 'failure_reason',
+ 'youtube_video_id',
+ 'youtube_url',
+ 'youtube_analytics',
+ 'is_autopilot',
+ 'duration_seconds',
+ 'processing_log',
+ ];
+
+ protected $casts = [
+ 'scenes' => 'array',
+ 'pexels_videos' => 'array',
+ 'youtube_analytics' => 'array',
+ 'processing_log' => 'array',
+ 'is_autopilot' => 'boolean',
+ ];
+
+ public function user(): BelongsTo
+ {
+ return $this->belongsTo(User::class);
+ }
+
+ public function youtubeChannel(): BelongsTo
+ {
+ return $this->belongsTo(YoutubeChannel::class);
+ }
+
+ public function isProcessing(): bool
+ {
+ return in_array($this->status, [
+ 'generating_script',
+ 'fetching_visuals',
+ 'generating_voiceover',
+ 'assembling_video',
+ 'uploading'
+ ]);
+ }
+
+ public function isReady(): bool
+ {
+ return $this->status === 'ready';
+ }
+
+ public function isUploaded(): bool
+ {
+ return $this->status === 'uploaded';
+ }
+
+ public function hasFailed(): bool
+ {
+ return $this->status === 'failed';
+ }
+}
diff --git a/app/Models/YoutubeChannel.php b/app/Models/YoutubeChannel.php
index e69de29..a176b83 100644
--- a/app/Models/YoutubeChannel.php
+++ b/app/Models/YoutubeChannel.php
@@ -0,0 +1,64 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\HasMany;
+
+class YoutubeChannel extends Model
+{
+ use HasFactory;
+
+ protected $fillable = [
+ 'user_id',
+ 'youtube_channel_id',
+ 'channel_title',
+ 'channel_description',
+ 'thumbnail_url',
+ 'subscriber_count',
+ 'video_count',
+ 'daily_upload_quota',
+ 'uploads_today',
+ 'quota_reset_date',
+ 'autopilot_enabled',
+ 'autopilot_settings',
+ 'last_video_uploaded_at',
+ ];
+
+ protected $casts = [
+ 'autopilot_settings' => 'array',
+ 'autopilot_enabled' => 'boolean',
+ 'quota_reset_date' => 'date',
+ 'last_video_uploaded_at' => 'datetime',
+ ];
+
+ public function user(): BelongsTo
+ {
+ return $this->belongsTo(User::class);
+ }
+
+ public function videos(): HasMany
+ {
+ return $this->hasMany(Video::class);
+ }
+
+ public function canUploadToday(): bool
+ {
+ // Reset quota if it's a new day
+ if ($this->quota_reset_date->isToday() === false) {
+ $this->update([
+ 'uploads_today' => 0,
+ 'quota_reset_date' => now()->toDateString(),
+ ]);
+ }
+
+ return $this->uploads_today < $this->daily_upload_quota;
+ }
+
+ public function incrementUploadsToday(): void
+ {
+ $this->increment('uploads_today');
+ }
+}
diff --git a/config/services.php b/config/services.php
index 6182e4b..e95e4c0 100644
--- a/config/services.php
+++ b/config/services.php
@@ -35,4 +35,10 @@ return [
],
],
+ 'google' => [
+ 'client_id' => env('GOOGLE_CLIENT_ID'),
+ 'client_secret' => env('GOOGLE_CLIENT_SECRET'),
+ 'redirect' => env('GOOGLE_REDIRECT_URI'),
+ ],
+
];
diff --git a/database/migrations/2025_08_02_160711_create_videos_table.php b/database/migrations/2025_08_02_160711_create_videos_table.php
index 80c6046..17cdc93 100644
--- a/database/migrations/2025_08_02_160711_create_videos_table.php
+++ b/database/migrations/2025_08_02_160711_create_videos_table.php
@@ -14,7 +14,7 @@ return new class extends Migration
Schema::create('videos', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
- $table->foreignId('youtube_channel_id')->nullable()->constrained()->onDelete('set null');
+ $table->unsignedBigInteger('youtube_channel_id')->nullable();
$table->string('title');
$table->text('description')->nullable();
$table->string('topic'); // User input topic
diff --git a/database/migrations/2025_08_02_201907_add_youtube_channel_foreign_key_to_videos_table.php b/database/migrations/2025_08_02_201907_add_youtube_channel_foreign_key_to_videos_table.php
new file mode 100644
index 0000000..1d84508
--- /dev/null
+++ b/database/migrations/2025_08_02_201907_add_youtube_channel_foreign_key_to_videos_table.php
@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('videos', function (Blueprint $table) {
+ $table->foreign('youtube_channel_id')->references('id')->on('youtube_channels')->onDelete('set null');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('videos', function (Blueprint $table) {
+ $table->dropForeign(['youtube_channel_id']);
+ });
+ }
+};
diff --git a/resources/js/Pages/Auth/Login.vue b/resources/js/Pages/Auth/Login.vue
index e091df2..5cd5ca6 100644
--- a/resources/js/Pages/Auth/Login.vue
+++ b/resources/js/Pages/Auth/Login.vue
@@ -24,6 +24,16 @@
</Link>
</div>
+ <!-- Demo Login Button -->
+ <div>
+ <Link :href="route('demo.login')" class="w-full flex justify-center items-center px-4 py-3 border-2 border-dashed border-blue-300 rounded-md shadow-sm text-sm font-medium text-blue-700 bg-blue-50 hover:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition duration-200">
+ <svg class="h-5 w-5 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
+ </svg>
+ Try Demo (No OAuth Required)
+ </Link>
+ </div>
+
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300" />
diff --git a/resources/js/Pages/Welcome.vue b/resources/js/Pages/Welcome.vue
index d0fac33..3668054 100644
--- a/resources/js/Pages/Welcome.vue
+++ b/resources/js/Pages/Welcome.vue
@@ -8,8 +8,8 @@
<h1 class="text-2xl font-bold text-white">YouTube Video Generator</h1>
</div>
<div class="flex items-center space-x-4">
- <Link :href="route('google.redirect')" class="bg-white text-gray-900 hover:bg-gray-100 px-4 py-2 rounded-lg font-medium transition duration-200">
- Get Started
+ <Link :href="route('demo.login')" class="bg-white text-gray-900 hover:bg-gray-100 px-4 py-2 rounded-lg font-medium transition duration-200">
+ Try Demo
</Link>
</div>
</div>
@@ -37,6 +37,12 @@
</svg>
Start with Google
</Link>
+ <Link :href="route('demo.login')" class="inline-flex items-center px-8 py-4 border border-white text-lg font-medium rounded-lg text-white hover:bg-white hover:text-gray-900 transition duration-200">
+ <svg class="h-5 w-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
+ </svg>
+ Try Demo
+ </Link>
<a href="#features" class="inline-flex items-center px-8 py-4 border border-white text-lg font-medium rounded-lg text-white hover:bg-white hover:text-gray-900 transition duration-200">
Learn More
</a>
@@ -161,11 +167,11 @@
<p class="text-xl text-gray-300 mb-8 max-w-2xl mx-auto">
Join thousands of creators who are already using AI to scale their video production.
</p>
- <Link :href="route('google.redirect')" class="inline-flex items-center px-8 py-4 border border-transparent text-lg font-medium rounded-lg text-white bg-indigo-600 hover:bg-indigo-700 transition duration-200">
- <svg class="h-5 w-5 mr-2" fill="currentColor" viewBox="0 0 24 24">
- <path d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"/>
+ <Link :href="route('demo.login')" class="inline-flex items-center px-8 py-4 border border-transparent text-lg font-medium rounded-lg text-white bg-indigo-600 hover:bg-indigo-700 transition duration-200">
+ <svg class="h-5 w-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
</svg>
- Get Started Free
+ Try Demo Now
</Link>
</div>
</div>
diff --git a/routes/web.php b/routes/web.php
index 4cc7e9f..eeaf823 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -1,6 +1,7 @@
<?php
use App\Http\Controllers\Auth\GoogleController;
+use App\Http\Controllers\Auth\DemoController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\VideoController;
use App\Http\Controllers\YoutubeChannelController;
@@ -19,7 +20,9 @@ Route::get('/', function () {
})->name('welcome');
Route::get('/login', function () {
- return Inertia::render('Auth/Login');
+ return Inertia::render('Auth/Login', [
+ 'error' => session('error')
+ ]);
})->name('login');
// Google OAuth Routes
@@ -28,6 +31,9 @@ Route::prefix('auth/google')->group(function () {
Route::get('/callback', [GoogleController::class, 'callback'])->name('google.callback');
});
+// Demo Login Route (for testing without OAuth)
+Route::get('/demo-login', [DemoController::class, 'loginDemo'])->name('demo.login');
+
Route::post('/logout', [GoogleController::class, 'logout'])->name('logout');
// Protected Routes