How bharathlakkoju/tubecp works
TubeCP is a YouTube research product: a signed-in user submits a topic, receives ranked video results, can turn those results into a persistent knowledge base, and asks source-grounded questions against it. The graph preserves the documented subscription, team-workspace, and hosted MCP capabilities. Source excerpts show the research and chat request ownership clearly; KB build internals, billing callbacks, and several integrations are represented at their exact directory or route paths, with uncertain connections omitted.
Main entry points: research/route.ts Research endpoint · subscription.ts Plans and usage · chat/route.ts Chat endpoint · AppResearchClient.tsx Research workspace
Components 31
Product experience
- Research workspace
app/(product)/app/AppResearchClient.tsx - Research history
app/(product)/app/researches/ResearchListClient.tsx - Ranked results
components/ResearchResults.tsx
Research workflow
- Research endpoint
app/api/research/route.ts - Topic research
lib/services/research-pipeline.ts - Query expansion
lib/services/query-expansion.ts - YouTube search
lib/services/youtube-search.ts - Relevance analysis
lib/services/relevance.ts - Saved research
lib/services/saved-research.ts
Knowledge bases
- Knowledge-base API
app/api/knowledge-base - Build orchestration
lib/kb/orchestrator.ts - Build workers
lib/pipeline - KB services
lib/services/knowledge-base.ts - Vector index
lib/store/vector-index.ts - Chat endpoint
app/api/chat/route.ts - Chat service
lib/services/chat.ts - Chat history
lib/services/kb-chat.ts
Accounts and platform
- Plans and usage
lib/billing/subscription.ts - Plan limits
lib/plans.ts - Session access
lib/auth.ts - Application storage
lib/store.ts - Redis adapter
lib/store/redis.ts - Billing routes
app/api/billing - Billing webhook
app/api/webhook/polar/route.ts - Team workspace
lib/workspaces.ts - Hosted MCP
app/api/mcp/route.ts - MCP tools
mcp/create-server.ts
Other components
- Researcher
- YouTube
- Neon Postgres
- Polar billing
Connections 39
- Researcher → Research workspace: submits topic
app/(product)/app/AppResearchClient.tsx - Research workspace → Research endpoint: requests research
app/(product)/app/AppResearchClient.tsx - Research endpoint → Session access: requires session
app/api/research/route.ts - Research endpoint → Plans and usage: checks usage
app/api/research/route.ts - Research endpoint → Topic research: runs pipeline
app/api/research/route.ts - Topic research → Query expansion: expands topic
lib/services/research-pipeline.ts - Topic research → YouTube search: searches videos
lib/services/research-pipeline.ts - Topic research → Relevance analysis: analyzes candidates
lib/services/research-pipeline.ts - YouTube search → YouTube: searches
- Research endpoint → Saved research: persists results
app/api/research/route.ts - Research endpoint → Application storage: caches results
app/api/research/route.ts - Research workspace → Ranked results: renders results
app/(product)/app/AppResearchClient.tsx - Researcher → Research history: views history
app/(product)/app/researches/ResearchListClient.tsx - Research endpoint → Research history: saves for listing
- Research workspace → Knowledge-base API: starts KB build
- Knowledge-base API → Session access: checks access
- Knowledge-base API → Plans and usage: checks allowance
- Knowledge-base API → Build orchestration: dispatches build
- Build orchestration → Build workers: coordinates jobs
lib/kb/orchestrator.ts - Build orchestration → KB services: invokes build
lib/kb/orchestrator.ts - Build workers → KB services: indexes content
lib/pipeline/embed-worker.ts - Build workers → Vector index: stores embeddings
lib/pipeline/embed-worker.ts - Researcher → Chat endpoint: asks question
app/api/chat/route.ts - Chat endpoint → Session access: requires session
app/api/chat/route.ts - Chat endpoint → Plans and usage: meters messages
app/api/chat/route.ts - Chat endpoint → Chat service: streams answer
app/api/chat/route.ts - Chat endpoint → Chat history: appends messages
app/api/chat/route.ts - Chat service → Vector index: retrieves sources
- Plans and usage → Plan limits: applies limits
lib/billing/subscription.ts - Plans and usage → Neon Postgres: reads subscription
lib/billing/subscription.ts - Plans and usage → Team workspace: applies team plan
lib/billing/subscription.ts - Application storage → Redis adapter: uses cache
lib/store.ts - Application storage → Neon Postgres: reads and writes
lib/store.ts - Billing routes → Session access: requires session
app/api/billing/change-plan/route.ts - Billing routes → Polar billing: creates checkout
- Polar billing → Billing webhook: sends events
- Billing webhook → Plans and usage: syncs plan
- Researcher → Hosted MCP: connects AI client
- Hosted MCP → MCP tools: creates server
app/api/mcp/route.ts