How cjw1645/youtube_trend works
This is a YouTube trend research dashboard for channel editors. The main workflow loads Korea’s popular-video sample or a signed-in user’s search results, presents video statistics and stored trend comparisons, and lets users save favorites or ask Gemini for evidence-based planning advice. The graph separates the client, API/domain services, and persistence/integrations. README-documented capabilities are included where source excerpts were unavailable; some links are therefore documented at the product level rather than traced through unsampled handlers.
Main entry points: api.ts API client · chat-service.ts Chat analysis service · App.tsx Application shell · supabase.ts Supabase access
Components 24
Web client
- Application shell
src/App.tsx - Authentication
src/hooks/useAuth.tsx - Video discovery
src/hooks/useVideos.ts - Trend dashboard
src/pages/Dashboard.tsx - Search tracking
src/components/SearchDashboard.tsx - AI conversations
src/hooks/useChat.ts - Chat session
src/lib/chat-session.ts - Saved videos
src/hooks/useFavorites.ts - API client
src/lib/api.ts
API and domain services
- Video endpoints
api/videos.ts - Video details
api/video/[id].ts - Stored trend endpoints
api/stored.ts - Search tracking API
api/search-data.ts - Search slot management
api/search-slots.ts - Scheduled collection
api/_lib/collect.ts - Trend calculations
api/_lib/trend.ts - Chat endpoint
api/chat.ts - Chat analysis service
api/_lib/chat-service.ts - Quota controls
api/_lib/usage.ts - Supabase access
api/_lib/supabase.ts
Persistence
- Supabase database
External services
- YouTube Data API
- Gemini
Other components
- Channel editor
Connections 28
- Channel editor → Application shell: uses
README.md - Application shell → Trend dashboard: opens
src/App.tsx - Application shell → Video discovery: loads
src/App.tsx - Application shell → Authentication: provides auth
src/App.tsx - Video discovery → API client: requests data
src/hooks/useVideos.ts - Trend dashboard → Search tracking: renders
src/pages/Dashboard.tsx - Search tracking → API client: requests comparisons
src/components/SearchDashboard.tsx - AI conversations → Chat session: manages requests
src/hooks/useChat.ts - Chat session → API client: posts questions
src/lib/chat-session.ts - Saved videos → API client: loads and saves
src/hooks/useFavorites.ts - API client → Video endpoints: calls
src/lib/api.ts - API client → Video details: calls
README.md - API client → Stored trend endpoints: calls
README.md - API client → Search tracking API: calls
README.md - API client → Search slot management: calls
- Video endpoints → YouTube Data API: fetches videos
README.md - Video details → YouTube Data API: fetches details
README.md - Scheduled collection → YouTube Data API: collects chart
README.md - Scheduled collection → Supabase access: stores snapshots
api/_lib/collect.ts - Stored trend endpoints → Trend calculations: serves trends
README.md - Search tracking API → Trend calculations: serves trends
README.md - Search slot management → Supabase access: manages slots
api/search-slots.ts - Chat endpoint → Chat analysis service: handles questions
README.md - Chat analysis service → YouTube Data API: loads metadata
api/_lib/chat-service.ts - Chat analysis service → Gemini: requests analysis
api/_lib/chat-service.ts - Chat analysis service → Quota controls: checks limits
api/_lib/chat-service.ts - Chat analysis service → Supabase access: loads stored context
api/_lib/chat-service.ts - Supabase access → Supabase database: reads and writes
api/_lib/supabase.ts