AI Income LabJoin AI Income Lab ↗

OpusClip clone with OpenCode: build a shorts web app

Jump to video chapters

Watch on YouTube ↗ Subscribe on YouTube ↗

By · · 15:26 · 3,937 views

Written guide: Build an OpusClip-Style Web App With OpenCode: Short Forge

Use OpenCode to scaffold Short Forge, a local web app that turns long YouTube videos into shorts like OpusClip, using Clerk, Prisma, Postgres and FFmpeg. The app is still a work in progress at the end, and no finished clips are shown.

Video summary

Opus Clip tutorial for builders who want an open-source OpusClip clone instead of another subscription.

The video covers 10 parts: -- Project Overview & OpusClip Concept, -- AI Prompting & Project Scaffolding, -- Architecture: Workers & API Logic, -- Full-Stack Setup (Prisma, Auth, OpenAI), -- API Key Configuration (Google, OpenAI, Clerk), -- Troubleshooting Build Errors & Local Server, -- UI Walkthrough & Subscription Logic, -- Debugging Database & Prisma Connection, -- Postgres Migration & Database Setup, and -- Local Storage Optimization (Replacing S3).

What this video covers

What you build

A local MVP web app called Short Forge with Clerk sign-up, a three tier pricing page and YouTube URL import, which is not yet producing clips by the end.

Tools used

Compare pricing: OpenCode. Some ↗ links are affiliate links, so I may earn a commission or credit. See every tool I recommend →

Key steps

Not covered

Summary written from the video's transcript and chapters.

In this video

  1. 0:00 -- Project Overview & OpusClip Concept
  2. 0:45 -- AI Prompting & Project Scaffolding
  3. 1:27 -- Architecture: Workers & API Logic
  4. 3:02 -- Full-Stack Setup (Prisma, Auth, OpenAI)
  5. 4:46 -- API Key Configuration (Google, OpenAI, Clerk)
  6. 5:48 -- Troubleshooting Build Errors & Local Server
  7. 8:54 -- UI Walkthrough & Subscription Logic
  8. 10:11 -- Debugging Database & Prisma Connection
  9. 11:29 -- Postgres Migration & Database Setup
  10. 13:19 -- Local Storage Optimization (Replacing S3)

Questions and answers

What does the OpusClip-style app need to run?

The generated app asks for an OpenAI API key for Whisper transcription, a Google Cloud client for the YouTube Data API, Clerk keys and a Postgres database.

How long did the first version take to build?

The minimal viable product took about 15 minutes to build in OpenCode, Mike says. More time followed fixing build and database errors.

Why did the YouTube import stall?

The app was set to store videos in Amazon S3, which was not configured. OpenCode then switched storage to a local folder on the machine.

Transcript

Hey there, welcome to the channel. In this video, I'm going to be building my own version of Opus Clip. I've got the website pulled up here. You can see it allows you to upload long- form videos or also pull them in from YouTube and create 10 viral clips. The fact of the matter is I already have custom skills which I've built out in previous tutorials which will not only trim and edit videos but also create YouTube shorts automatically within a few seconds completely for free using

OpenCode. So in this tutorial I just want to basically replicate Opus clip and create my own web app which I can use at any time. I'm also considering making this public. I'll put it up on a Vercel account or something. So, if you guys are interested, let me know in the comments below. I've just gone ahead and created a detailed complete prompt over here inside Claude Desktop.

Read the rest of the transcript

I've told it to create a prompt to build a web app using OpenCode, which replicates the features in Opus Clip for creating YouTube shorts from long form videos. It will use the available custom skills that I already have access to to create the YouTube shorts and produce ready to post shorts in the web app. We're going to use FFmpeg, which is exactly what I'm using in my custom skill over here. That's what it's using to actually create the videos.

So, if I'm running it locally on my own machine, that's going to be no problem whatsoever. This is the complete detailed prompt that I pasted into OpenCode. And we can see here it's doing the project scaffolding, the file upload flow, YouTube URL import exactly the same as from the prompt that I've provided over here. I'm using Quinn 3.6 plus free, which I've been really happy with. It's very fast and it essentially costs zero credits in order to build with this.

We've also got access to Neotron 3, which is an Nvidia model, as well as Big Pickle and Miniax 2.5, and a whole bunch of other models here because I've connected many different providers into my OpenCode. As you can see, it's just going ahead and building out the complete app, creating all of the files that I will need over here in this directory, including the workers, components, the app, and also the library files that we're going to need.

So, essentially, what this is going to allow me to do is create my own version of Opus Clip, which I can use for my own purposes, and then also I would consider making this publicly available as well. If you guys are interested in using this when it's finished, let me know in the comments. So now after about 10 more minutes of building the app, you can see it's creating all of the files here. So we've got the video render worker.

You can see here's the video renderer. And if we go ahead and open that up, we can take a look at it. This is responsible for doing the video rendering. And then we've got another file for handling the video import as well. This is just another worker file. I don't really know what any of this code does, but fact of the matter is I don't have to know what it does because the AI is just building all of it for me.

For Short Forge, here's the project overview. It's a full stack web app that converts long- form YouTube videos into viral YouTube shorts with AI powered clip detection, animated captions, and smart reframing. Very, very similar to what we have over here in Opus Clip. And it only took me about 15 minutes to build the minimal viable product. So, we'll see how good this actually is. It's also got the directory structure here as well. So, we've got Prisma built in.

We've got the S3 client, which is I think AWS, as well as OpenAI client for the AI functions and some of the background job workers as well. But you can see over here when I do an npm run build, we're still getting a lot of errors. I think it's because it's not actually done building out all of the files yet. Looks like it's still working on the settings page.

So once that's done, we should be able to do the the run build and get something up and running. It says the Short Forge project has been fully scaffolded in this project directory. And it shows a full rundown of what was built as well in 43 different files. Here's the pages and the routes. So we've got the dashboard, uh, sign in, sign up with Clerk. It's even created the pricing page, which is a three tier subscription, free creator or pro.

very very similar to over here in Opus Clip. And we've got all of the API routes, eight different endpoints. And it's got the workers in here to download, transcribe, analyze, and create clips and refframe them into 9 by6 format for YouTube shorts and add the subtitles plus upload. It's also got the Prisma client, which is basically the backend, as well as the AWS client and whisper transcription using OpenAI. And the database schema is also included as well.

So now it gives me the instructions to actually run this. I will need to enter in my API keys. So I'm just going to do open.v. And you can see here's the different API keys that I'm going to need to enter in. So we've got the open AI API key which we can get easily as well as the AWS for storing the videos in Amazon AWS web server and the YouTube client ID which we're going to get from uh the cloud console uh Google cloud console

and for the payments we're going to be using cream which is exactly that's the same payment service that I use in my software as a service tube analytics so I already know how to use that. Basically, we're just going to want to get these different credentials and then we can go ahead and run it. If I want to run it right now, I could just do npm rundev. So, I'm just going to copy that. I'm going to paste it in over here.

And that's just going to start it up running on my local server on port 3000. So, if I go ahead and click on this, we should see exactly what the app looks like. And unfortunately, it looks like it is having an error over here. I can copy and paste this and then we can just come over here and say fix this build error and then we're just going to paste in the error right here. So, OpenCode will get to work fixing that build error.

And in the meantime, I'm just going to start filling out these API keys. In this case, I'm just going to create a new project in Google Cloud Console. We're going to call it Short Forge. And then we can just add it here. We're going to create the new project. And then from there, we can click on get started. Then we can give it a name. So it's called Short Forge. And then we'll provide an email. And then just go next.

In this case, we're just going to be using it internally. I can make it external for now. And then we can enter in the specific email. So I'm just going to enter in my email here. Go next. Agree to the Google API services and conditions. And then click on continue. And then create. So that's just going to create the new project inside Google Cloud Console. Application type is going to be web application. Just going to call it short forge in this case.

So now that we've created our application and gotten the client ID key and also the secret over here inside Google Cloud Console, we will most likely need to give it access to some of the APIs. So in this case, I would just use the YouTube data API. I'm going to click on enable. And now we'll have access to the YouTube data API and we can give it access to everything over here as well. We're also going to grab our OpenAI API key as well.

So just go to platform.openai.com and then you'll come down to API keys. So once again, we're just going to call it short forge and we'll create the secret key and then I'm just going to copy and paste this into myv file. And for Clerk, if you're not already familiar with Clerk, this is one of the best user authentication platforms. You're just going to want to create your account over here. And then you can uh create your application.

So once again, I'm just going to call it Short Forge. This is what the login and sign up page is going to look like. So it's creating the application now. And then we can come over to configure and we can just grab those API keys uh under developers. And I think it's under API keys here. So, we're just going to enable API keys.

So, I'm just going to copy and paste the publishable key as well as the secret key into myv file so that users will be able to sign up and log into their account using clerk inside shortforge. After another 10 minutes or so, I was able to hopefully fix the build errors that I was having with Clerk. It says right here, it fixed the issues with the Clerk version 7 imports. And it says all 20 routes compile and generate now.

So, if I come back over here, I can once again run npm rundev. And hopefully, it will build with no problems whatsoever. And we're just going to open it up and we'll see what it looks like. Let's see if we actually get a page loading over here. This is the Short Forge app. It says, "Turn long form videos into viral shorts." And we can easily get started completely for free. I'll just click on get started free.

And as you can see here, we have the option to create an account using Clerk. This is just on a development server. You can see it's in development mode for now since this is not actually in production and live on a website yet. This is just running on my local server. We can also take a look at the pricing here.

So, if I open up pricing, you can see it's got the three tier subscription plan, the free model, creator plan for $19 a month, and the pro plan for $49 a month, as well as all of the features. If I click on subscribe, that should take me over to the cream checkout page. But these buttons aren't quite working yet. So I'm just going to go ahead and click on get started free. I'm going to fill out my information over here.

And then we can click on continue. So that will create the account in clerk. And hopefully it goes through no problem whatsoever. And it will redirect me to my dashboard after I enter in the code. Here is 620612. That's another nice thing about clerk. Now it's creating the account and it should drop me into my dashboard over here hopefully. Uh it's not able to access the Prisma database for some reason. So once again, we're just going to come over here.

So we're just going to copy this whole thing and we're going to tell it to fix this build error on the dashboard so that we can actually get access to all of the features that are built into Short Forge. So that should have fixed it. Now it says the build passes. It fixed by switching from accelerate URL to Prisma adapter.pg for direct Postgress connections. And uh if I go ahead and refresh it now um unfortunately I'm now getting an internal server error which is not good.

So we can see over here it is still throwing an error which I can't make heads or tails out of. But that's fine because all I have to do is copy and paste this entire error right here. We're going to copy that and we're going to say once again fix this build error. This is one of the best ways to do debugging using the AI models that are built into OpenCode and it will go through and get to work right away.

It's checking to see if Postgress is running and apparently it is running. So that's good. It's going to check the actual database user see if we can create the database. It's telling me over here that I need to run these commands in the terminal in order to create the Postgress user with a password. So I've just gone ahead and run this command right here. Then we can also create the database as well. Once this is done, I'm just going to enter in my password.

And we can enter that in one more time. That's going to create the user. And now we can also create the database as well. So now that that's done, I've provided the correct should be the correct Postgress URL now. And we can also just go ahead and restart Postgress. So we'll come over here and do a restart to just restart it. And then we can run mpm rundev again and hopefully it will be able to present the dashboard and we can get started right away.

So this is what the interface looks like. Obviously it leaves a lot to be desired. It doesn't look that great. We definitely need to fix this up a little bit. But if I wanted to, let's say, uh, import a YouTube URL, I can give that a try. I'm just going to come over to my YouTube channel here. We're going to copy and paste the link of my latest video. And we're just going to paste that in.

And hopefully it should be able to import the video from this YouTube link. And we'll get a display here with the video. But unfortunately, it says failed to create project. I just had to restart the dev server. And now you can see it's got the projects. We can create a new project. I'm going to come in here. I'm going to just going to paste in that YouTube URL. We can import the video. And it looks like finally the database is working correctly. Finally.

So now it's processing the video. It's going to download the video into my Postgress database and we should be able to see what the actual features look like for creating the YouTube shorts. It seems to be taking a very long time to actually process and download the video. And I think that's because it's not storing the videos in the Postgress database. There was stuff. It says the video files are not stored in Postgress. That would be terrible for performance.

The architecture is it's storing the video files in S3, which I haven't actually configured yet. That's an Amazon AWS service. So I would need to set that up so that it can actually store the files somewhere. In this case, I don't really want to use Amazon S3 for the video file storage. I'm just going to skip it entirely since this is running on my local machine. I just want to store the video files in a storage folder. This is what OpenCode recommends.

That way, I don't have to screw around with creating the Amazon AWS account and then potentially even spending money on the server storage and all that stuff. I'm just going to store these locally on my machine. So, I've just told it to go ahead and use the local dev storage folder for storing the videos. And now it's going to start modifying the code and adding some extra code here to store the videos on my local machine where I'm running the app.

So now it looks like it has replaced S3 with the local file system storage and it created these files and to manage the uploads and we should be able to now grab a YouTube URL and import the video and it will just download it to my local directory if everything goes according to plan. So you can see here it's processing the video. It's going to download it.

Anyway, the project is still very much a work in progress, but it's coming together and I just wanted to make a tutorial showing how to build a simple app like this inside OpenCode. Hopefully, you enjoyed the tutorial. Please go ahead and subscribe to the channel if you haven't already. And also check out my Skool community which is completely free to join. We've currently got 2700 members in here. It's growing fast.

You could check out the classroom where we have lots of tutorials, courses, and helpful resources, as well as introduce yourself in the community tab. Would love to see you inside the Skool community. And with that being said, thank you so much for watching this tutorial. Hope you got value from it. Please go ahead, subscribe to the channel. Take care. Stay safe. Peace from Thailand. Signing off.

Not ready to join? Get the weekly build notes: new guides and tested builds in one short email.

You may also like