Project developed during NLW AI, an event held by Rocketseat with the aim of deepening knowledge of JavaScript, TypeScript and especially how to consume OpenAI's Artificial Intelligence to create video titles and descriptions.
The program aims to generate titles and descriptions for videos that will be published on YouTube using AI. To accomplish this, the website has been developed so that users can upload a video to the platform, input relevant keywords for the video, and, based on this data, the video is converted into audio. Subsequently, the audio is transcribed into text. With the generated text, users can choose the type of content they desire. Using the OpenAI API, three examples of the requested content will be generated.
- JavaScript: base programming language of the project
- TypeScript: programming language developed to add advanced features to JavaScript, such as static typing and interfaces
- Node.js: allows the execution of JavaScript code outside the browser
- React: create user interfaces on web pages
- Tailwind CSS: CSS framework used to style pages in a faster and more practical way
- Radix UI: library of highly customizable and accessible user interface (UI) components for building modern web interfaces
- Shadcn/ui: collection of reusable components that can be used in applications
- Fastify: framework used to build high-performance web APIs
- Zod: library used for data validation in APIs
- SQLite: C language library that implements an embedded SQL database
- Prisma: ORM for SQL databases used to simplify data access and manipulation in web applications
- FFmpeg: tool used for audio and video manipulation
- OpenAI API: integrate the artificial intelligence developed by OpenAI into the project
Before testing the project, you need to configure and run the server locally. To do this, follow the steps below:
2. Clone this repository on your machine
- Create a folder on your computer for this program
- Open the
terminal
inside this folder - Copy the URL from the repository
- Type
git clone <URL copied>
and pressenter
3. Still in the terminal, enter the cloned project folder using the command cd upload.ai
and install the pnpm package manager: npm install -g pnpm
- With the project open in the IDE, open the server folder using the command
cd server
- Now run
pnpm install
to install the folder
- Change the name of the
.env
file, removing the .example at the end of it - Log in to OpenAI, generate a new API key and paste it between the brackets of the
OPENAI_KEY
field in the .env file (if you have any doubts about this process, watch this tutorial)
6. Inside the server folder, create a folder called tmp
(and leave it empty), it will be responsible for saving the audios generated from the inserted videos
- Run the command
pnpm prisma migrate dev
to create the database configured in the file schema.prisma - Finally, run the
pnpm run dev
command to start the API
If you've followed all these steps and see the message Server is running on port 3333
in the terminal, the API is already working correctly, just open the site hosted via this link and test the program.
Observation: if you encounter an error while uploading the video, your API key may not be valid. Please verify that you have the correct access to the OpenAI API.