Build a local web app that takes a YouTube URL, fetches its transcript, and uses Gemini AI to generate structured study notes with code extraction.
Important
Gemini API Key: You will need a GEMINI_API_KEY environment variable. The app will use Gemini 2.0 Flash (the latest stable flash model) via @google/generativeai. Please confirm you have a key, or I'll add a placeholder in .env.local.
Note
Tailwind CSS version: The user requested Tailwind CSS. I will use Tailwind CSS v4 (the default with latest Next.js/create-next-app). Shadcn/UI will be initialized via npx shadcn@latest init.
┌─────────────────────────────────────────────────┐
│ Next.js App │
│ ┌──────────┐ ┌──────────┐ ┌───────────────┐ │
│ │ Landing │ │ Notes │ │ Library │ │
│ │ Page (/) │ │ (/notes) │ │ (/library) │ │
│ └────┬──────┘ └────┬─────┘ └───────┬───────┘ │
│ │ │ │ │
│ ┌────▼──────────────▼────────────────▼───────┐ │
│ │ API Routes (/api) │ │
│ │ POST /generate GET /notes GET /notes/id │ │
│ └────┬───────────────┬───────────────────────┘ │
│ │ │ │
│ ┌────▼────┐ ┌──────▼─────┐ ┌────────────┐ │
│ │YouTube │ │ Gemini AI │ │ SQLite DB │ │
│ │Transcript│ │ Pipeline │ │ (local) │ │
│ └─────────┘ └────────────┘ └────────────┘ │
└─────────────────────────────────────────────────┘
Scaffold via npx -y create-next-app@latest ./ --ts --tailwind --eslint --app --src-dir --import-alias "@/*" --turbopack --yes. Then install:
youtube-transcript— fetch YouTube transcripts without API key@google/generativeai— Gemini AI SDKbetter-sqlite3+@types/better-sqlite3— local SQLite storagelucide-react— icon libraryreact-markdown+remark-gfm+rehype-highlight— render markdown notes with syntax highlighting
fetchTranscript(url: string)— Extract video ID from URL, callyoutube-transcriptto get timed transcript segments, join into full textextractVideoMetadata(url: string)— Parse video ID, title (from page scrape or oEmbed)
generateNotes(transcript: string, videoTitle: string)— Send transcript to Gemini with a structured prompt that produces JSON with sections:executiveSummary,technicalDeepDive,codeBlocks[],keyTakeaways[]- Code Extraction Logic: The prompt explicitly instructs Gemini to detect any mention of functions, classes, variables, or specific syntax in the transcript and reconstruct accurate code blocks with language tags
- Initialize SQLite database at
./data/codenotes.db notestable:id,videoId,videoTitle,videoUrl,thumbnailUrl,executiveSummary,technicalDeepDive,codeBlocks (JSON),keyTakeaways (JSON),createdAt- CRUD:
saveNote(),getAllNotes(),getNoteById(),deleteNote()
POST— accepts{ url }, fetches transcript, calls Gemini, saves to DB, returns the note
GET— returns all saved notes (summary view)
GET— returns a single note by IDDELETE— deletes a note by ID
- Landing page: Premium dark gradient background, centered hero section
- YouTube URL input with animated border glow on focus
- Submit button triggers
POST /api/generate - Loading state with pulsing skeleton animation
- Fetch note by ID from API
- Render structured sections: Executive Summary, Technical Deep Dive, Code Blocks (with copy button), Key Takeaways
- Use
react-markdownwithrehype-highlightfor code syntax highlighting - Sticky header with video title and back navigation
- Grid/list of all saved notes with thumbnail, title, date
- Click to navigate to individual note
- Delete button with confirmation
- Empty state with illustration
- Animated input with YouTube icon, validation, submit handler
- Card for library grid: thumbnail, title, date, preview text
- Custom code block renderer with language label and "Copy to Clipboard" button
- Clipboard animation feedback (checkmark on success)
- Full-screen loading overlay with animated progress messages
- Top navigation: logo, links to Home and Library
- Dark mode color scheme (deep navy/charcoal backgrounds, cyan/purple accents)
- Google Font import (Inter/Geist)
- Custom scrollbar styling
- Glassmorphism utility classes
- Animation keyframes (glow, pulse, fade-in, slide-up)
- Start dev server:
npm run devind:\unstuckstudy - Open
http://localhost:3000in browser - Verify landing page renders with dark theme, URL input, and navigation
- Enter a YouTube coding tutorial URL (e.g.,
https://www.youtube.com/watch?v=dQw4w9WgXcQor a real tutorial) - Submit and verify loading state appears
- After generation, verify note page renders with all sections
- Navigate to
/libraryand verify the note appears in the list - Test copy-to-clipboard button on a code block
- Visually inspect UI quality and dark mode aesthetics
- Confirm generated notes are accurate and code blocks are properly formatted
- Test with different YouTube URLs (coding tutorials, lectures, etc.)