-
-
SEOTube VS YT Studio
-
Flow Architecture (Present in the README)
-
AuthPage
-
AuthPage2
-
AuthPage3
-
HomePage
-
HomePage2
-
HomePage3
-
UserPage
-
UserPage2
-
VideosPage
-
Email
-
Email2
-
AI Result
-
DB
-
Open Sourced
-
MailMobile
-
Planning flow for AI suggestions and Delay alert mails
-
MailMobile2
-
MailMobile3
-
ENV setup instructions with best guide available on the internet
SEOTube - Automatic YouTube SEO Assistant
Keep every video growing automatically. SEOTube finds underperforming videos, generates AI-backed SEO updates (title, description, tags), applies them to YouTube videos, and notifies you, all on a configurable schedule.
The Spark Behind the Idea ✨
Inspiration 1
Have you ever noticed that while surfing on YouTube, you saw a video impression but ignored it and then the same video appeared again in your feed, this time with a better thumbnail and title?
Actually, changing the metadata of old videos is a very common practice among all YouTubers, including me. And really, it is a pain for all of us. 😢
There are 115+ million creators on YouTube, and we all do this manually. For many of our videos, the content is really good, but because of poor metadata, the video doesn’t get impressions, good rankings, and hence views.
So I thought, why don’t I make a free solution that automates this process? Later, I added a lot of other features to this solution (SEOTube!!).
Inspiration 2
Do you know Twitter was started as a hackathon project? I really want any of my creation to grow like that. Hence, I want to make SEOTube to be the first choice of every creator. I have a lot of plans in my head to make it big.
Inspiration 3 There is website YouTube Playlist Length, I have used this website a lot during my college time to calculate length of YouTube courses. But the amazing thing is it was built by a college student as a side project and now it has 10k monthly users. I really wanted to use YouTube API to build something similar that helps people.
What SEOTube Does? 🔮
SEOTube comes packed with many features, but below is an overview of the core functionality
- Detects the 5 (decided via .env
NUMBER_OF_VIDEOS) least performing videos per channel. - Sends the videos' metadata to an AI model for SEO optimization and an SEO score is generated for new metadata.
- Applies the AI-suggested title, description, tags, and recommended
categoryIdback to the same videos. - Emails a summary to the user with SEO score and change comparison after each run.
- Cron Job runs again after a fixed interval (eg: 10 days decided via
CRON_TIME) for same or new least performing videos.
+--------+ +------------------+ +--------+ +--------------+ +---------+
| CRON | --> | Detect Videos | --> | AI SEO | --> | Update | --> | Email |
+--------+ +------------------+ +--------+ +--------------+ +---------+
|
v
(Repeat)
What's Inside The Box? 🎁
- Automatic recurring optimization via
node-cronwith configurableCRON_TIME. Users can pause/resume automatic updates. - Optimization Confirmation Mail with SEO Score: A mail is sent which confirms the optimization with old and new metadata of videos. It also shows the user the possible SEO score of new metadata.
- On-demand optimization: User can optimize any single video from the UI immediately.
- AI channel analysis & ideas: On signup, SEOTube analyzes your latest videos and returns channel-level advice plus five targeted video ideas. Ideas are
cachedand refreshed only when new videos appear to save AI tokens. - Email reminders with AI-generated ideas: Daily job sends reminder emails to users who haven't uploaded within
REMINDER_THRESHOLD_DAYSand includes five new video ideas. - Consistency tracking: A small graph shows gaps between recent uploads and helps creators see patterns.
- Secure auth & tokens: Password hashing with
bcrypt, JWT auth, and encrypted refresh tokens usingaes-256-gcm. - List of least performing videos: User can see the least performing videos listed on homepage.
Open Sourced 🐙
Since SEOTube requires editing permissions on a user’s channel, I didn’t want permission concerns to stop anyone from using it. To ensure full transparency and user control, SEOTube is open-sourced under the Apache 2.0 license. Currently contributions are not allowed because of hackathon. But to make SEOTube big, I will soon start accepting PRs from others, and I will also start participating in events like Hacktoberfest and GSoC.
- User can clone SEOTube, modify it, change env variables and deploy it on their own backend servers.
- I have made the README file so simple to understand so that even non-coders can also understand it. And I will make it even easier in future.
- If user runs on his own cloud server, it will cost user less than a dollar 💲 if he runs 5 optimization jobs (10 video at a time) and 20 on demand optimizations per month.
How It's Crafted 🎨
OAuth Flow & Refresh Token Encryption 🧩
When a user connects their YouTube channel, Google OAuth returns a short-lived access token and a long-lived refresh token, which lets SEOTube make API calls without repeated logins. Since storing refresh tokens in plain text is risky, SEOTube secures them using AES-256-GCM encryption.
// Encryption: 32-byte key derived from a secret
const KEY = crypto.createHash("sha256").update(SECRET).digest();
const iv = crypto.randomBytes(12); // 96-bit nonce for GCM
const cipher = crypto.createCipheriv("aes-256-gcm", KEY, iv);
const encrypted = Buffer.concat([cipher.update(plain, "utf8"), cipher.final()]);
const tag = cipher.getAuthTag();
// Store: [iv (12 bytes) | tag (16 bytes) | encrypted data]
During decryption, SEOTube extracts the IV and authentication tag and then decrypts the token. The GCM tag guarantees the token hasn’t been tampered with, while the random IV ensures unique ciphertext for the same plaintext. The encrypted refresh token is stored in the User document and is decrypted only when SEOTube needs to make YouTube API calls.
Cron Optimization Flow 🧩
SEOTube’s core value lies in its scheduled cron job (via CRON_TIME) that automatically optimizes underperforming videos.
cron.schedule(process.env.CRON_TIME, async () => {
await runSeoCron(); // Scheduled trigger (e.g., every 15 days)
});
The sequence:
- Fetch Users : Query all users with active YouTube connections and
pauseCronUpdatedisabled. - Decrypt & Authorize : For each user, decrypt their refresh token and set YouTube API credentials.
Fetch Analytics : Call YouTube Analytics API to get videos' data (metadata and URLs) and filter least performing videos.
const analytics = google.youtubeAnalytics({ version: "v2", auth: oauth2Client }); const response = await analytics.reports.query({ ids: "channel==MINE", startDate, endDate, dimensions: "video", metrics: "views,averageViewDuration", sort: "-views", maxResults: 100, });Build AI Prompt : Format the video data (title, description, tags, views) and channel name into a structured prompt.
const prompt = buildPrompt(videos, channelName);Call Gemini AI : POST the prompt to SEOTube's AI endpoint, which calls Google's Generative AI. The AI returns optimized title, description, tags (×20), recommended categoryId, and an SEO score (1–100).
Apply Updates : For each AI-suggestion, call YouTube Data API v3's
videos.update()endpoint.await youtube.videos.update({ part: ["snippet"], requestBody: { id: videoId, snippet: { title, description, tags, categoryId } } });Update User Record : Set
lastOptimizedAttimestamp for user's reference and next optimization calculation.Send Email : Uses
Resend APIto email a summary showing old vs new metadata and SEO improvement scores.
This entire flow runs without user intervention. If a user pauses automatic updates, the cron skips them.
AI Flow 🧩
SEOTube uses Gemini AI with a strict JSON-only prompt for efficient and reliable parsing.
- Input: List of underperforming videos with current title, description, tags, view count, and channel name.
- Output Spec: A JSON array where each video gets:
- Optimized title (max 70 characters, with power words and channel name)
- Optimized description (with keywords, CTAs, hashtags)
- 20 long-tail and broad tags (critical for search discoverability)
- CategoryId (a numerical YouTube category like 20=Gaming, 27=Education)
- SEO Score (1–100, representing potential CTR and ranking improvement) The response is validated before being applied to the videos.
Channel Analysis & Video Ideas generation Flow 🧩
On signup, SEOTube runs a growth analysis by sending metadata from user’s 5 latest videos to AI using a dedicated prompt. This analysis is cached, the system remembers the latest uploaded video's ID. If no new videos exist, it returns cached advice. Once a new video appears, the analysis runs again, refreshing advice and ideas without unnecessary AI calls. The advice and ideas are stored on the User model:
user.prevUploadedVideoId = currUploadedVideoId;
user.marketingAdvice = analysis.message;
user.videoIdeaList = analysis.ideaList;
This ensures users always see fresh insights aligned with their current output.
Core AI Prompt 👾
This concise prompt is the core of SEOTube's optimization flow
You are a Senior YouTube SEO Strategist.
Task: Rewrite the metadata for the provided list of low-performing videos to maximize Click-Through Rate (CTR) and search visibility. Also use ${channelName} intelligently in all metadata.
Optimization Requirements for EACH Video:
- Title: Front-load the primary keyword. Use power words or numbers to create curiosity. (Max 70 chars). Add channelName "title" | "channelName"
- Description: Start with a 4-5 sentences hook containing keywords. Include a brief summary and a clear Call-to-Action (CTA). (Max ${process.env.DESCRIPTION_CHARACTERS_COUNT} chars) and with # hashtags related to video.
- Tags: Provide exactly 20 tags, mixing broad category terms and specific long-tail keywords.
- CategoryId: Select the most accurate numerical ID from the standard YouTube Data API v3 list (e.g., 20 for Gaming, 27 for Education).
- SEO Improvement Score: Provide a score between 1 and 100, indicating the potential improvement in after using new metadata.
Constraints:
- Do NOT alter the 'videoId'.
- Maintain a [Professional/Casual/Engaging] tone throughout.
- Return ONLY a valid JSON array of objects.
- Do NOT include markdown
- Do NOT include explanations
- No code blocks
Input:
${JSON.stringify(videos, null, 2)}
Output format:
[
{
"videoId": "string",
"title": "string",
"description": "string",
"tags": ["string"],
"categoryId": integer,
"seoScore": integer
}
]
What's ahead (future plans) ⛰️
Major Feature Plans
- On demand thumbnail update
Video Upload from SEOTube. SEOTube will take out audio chunks from video, compress it and send it to AI. AI will generate metadata for the video including thumbnail, timestamp, title, description, tags, categoryId, etc., and will upload the video to YouTube.
+-------+ +-------+ +--------+ +-------+ +--------+ +--------+ +-------+ | Video |--> |Extract|--> |Compress|--> |AI |--> |Generate|--> |Add |--> |Publish| | Input | |Audio | |Audio | |Analyze| |Metadata| |Metadata| | | +-------+ +-------+ +--------+ +-------+ +--------+ +--------+ +-------+User will be able to add some channel as a competitor, and SEOTube will analyze the competitor's videos and generate ideas for the user.
AI Personalization via RAG (Retrieval-Augmented Generation).
Existing Feature Enhancements
- Metadata will be generated using the most trending videos and competitors content on the same topic
- Video analysis will be done on other factors like impression, CTR, etc.
- Cron Job will only optimize a video again in next cycle if there is no change in video's performance.
- AI suggestions will be given by searching the youtube for similar niche
- Extra personalization features for user including choosing the AI model.
- User will set the alert time for the upload reminder.
- Login with Google account directly and Gmail verification
Scalability Enhancements
- Division of data in different collections
- Cron jobs will be scheduled to run at specific times according to the set of users
Use of TOON (Tokenized Object-Oriented Notation) to compress AI prompts and reduce token wastage by 70%.
JSON: {"id":"abc","title":"YouTube SEO Guide 2024","score":87,"tags":["seo","youtube"]} --> 89 tokens TOON: id:abc|t:YouTube SEO Guide 2024|s:87|tg:seo,youtube --> 26 tokens
What I Learnt 🌱
This project was full of new things that I had never used before. I have listed them below:
- I learnt about cron jobs and schedulers, and I was really amazed at how they wake up at fixed intervals, check a lightweight schedule table, and go back to sleep if nothing is due.
- I learnt how OAuth, Access tokens and Refresh tokens work.
- I have used Bcrypt library before in my old projects but I never knew that it never decrypts your data. It just verifies. Actually I was trying to store Refresh token just like the password but I also wanted the decrypted version of them. And then I found that I can't do that. And finally I used a separate encryption logic (AES-256-GCM algorithm).
- Using AI APIs, I had just seen other developers using AI APIs to build cool projects and I always used to think that it will be hard to use them. But this time I thought of crossing all boundaries. And I did it.
- I learnt to use YouTube APIs.
- Writing README, yes I really used to think that it is just a normal text file. But in this project I used a lot of it's formatting features to make it easier to understand.
- Consistency, I think this is the biggest thing I got from this project if you check my GitHub profile you will find that I have done at least one valuable commit per day from the day I stared this project. I will continue the development even after the hackathon ends.
- Also for the demo creation, I used chatgpt for image generation and Capcut for editing (first time).
Built With
- aes-256-gcm-algorithm
- css
- express.js
- gemini-api
- javascript
- mongodb
- node-cron
- node.js
- react
- recoil-state-management-library
- resend-api
- typescript
- vite
- youtube
- youtube-analytics-api
Log in or sign up for Devpost to join the conversation.