How akash-sharma8/youtube-transcript-chatbot works
TubeMind AI is a YouTube-transcript RAG chatbot. Users submit a video URL to index its transcript, then ask questions scoped to that video; answers can include transcript timestamps. The graph follows the evidenced API routes and their runtime dependencies. The README documents the broader indexing and retrieval workflow; some supporting modules were not sampled, so uncertain connections are omitted.
Main entry points: route.ts Index endpoint · Chat.tsx Chat interface · chat.ts Chat service · page.tsx Application page
Components 25
User experience
- Application page
app/page.tsx - Video input
components/index/VideoInput.tsx - Chat interface
components/chat/Chat.tsx - Question input
components/chat/ChatInput.tsx - Chat state
hooks/useChat.ts - Message window
components/chat/ChatWindow.tsx - Message rendering
components/chat/ChatMessage.tsx
API routes
- Index endpoint
app/api/index/route.ts - Chat endpoint
app/api/chat/route.ts
Transcript indexing
- Video ID parsing
lib/youtube/video-id.ts - Transcript fetch
lib/transcript/fetch.ts - Transcript merging
lib/transcript/merger.ts - Document creation
lib/transcript/document.ts - Chunk splitting
lib/transcript/splitter.ts - Vector indexing
lib/indexing/indexer.ts
Retrieval and answers
- Chat service
lib/chat/chat.ts - Chat prompt
lib/chat/prompt.ts - Similarity retrieval
lib/retrieval/retriever.ts
AI and storage
- Hugging Face embeddings
lib/embeddings/huggingface.ts - Video collections
lib/chroma/collections.ts - Chroma client
lib/chroma/client.ts
Other components
- Video user
- ChromaDB
- Groq LLM
- Transcript API
Connections 27
- Video user → Application page: opens
README.md - Application page → Video input: shows
app/page.tsx - Application page → Chat interface: shows
app/page.tsx - Video input → Index endpoint: submits URL
README.md - Chat interface → Question input: uses
components/chat/Chat.tsx - Chat interface → Chat state: uses
components/chat/Chat.tsx - Chat interface → Message window: uses
components/chat/Chat.tsx - Message window → Message rendering: renders
components/chat/ChatWindow.tsx - Chat state → Chat endpoint: posts question
hooks/useChat.ts - Index endpoint → Video ID parsing: parses URL
app/api/index/route.ts - Index endpoint → Transcript fetch: fetches transcript
app/api/index/route.ts - Transcript fetch → Transcript API: requests transcript
lib/transcript/fetch.ts - Index endpoint → Transcript merging: merges segments
app/api/index/route.ts - Index endpoint → Document creation: creates documents
app/api/index/route.ts - Index endpoint → Chunk splitting: splits documents
app/api/index/route.ts - Index endpoint → Vector indexing: indexes chunks
app/api/index/route.ts - Vector indexing → Hugging Face embeddings: embeds chunks
lib/indexing/indexer.ts - Vector indexing → Video collections: adds vectors
lib/indexing/indexer.ts - Chat endpoint → Video ID parsing: parses URL
app/api/chat/route.ts - Chat endpoint → Chat service: asks question
app/api/chat/route.ts - Chat service → Similarity retrieval: retrieves context
lib/chat/chat.ts - Chat service → Chat prompt: builds prompt
lib/chat/chat.ts - Chat service → Groq LLM: invokes model
lib/chat/chat.ts - Similarity retrieval → Hugging Face embeddings: embeds query
lib/retrieval/retriever.ts - Similarity retrieval → Video collections: queries collection
lib/retrieval/retriever.ts - Video collections → Chroma client: uses client
lib/chroma/collections.ts - Chroma client → ChromaDB: connects
README.md