How itz-snj/prism works
Prism is a YouTube learning workspace: users ingest videos, follow background processing, then chat with transcript content and generate/submit quizzes. The backend also provides video/search and API-key management; the frontend exposes dashboard, workspace, and settings views. Edges follow shown calls/import references or README-documented flows. The worker’s detailed implementation and most frontend page-to-API calls were not excerpted, so those relationships are shown only where documentation supports them or are omitted.
Main entry points: prisma.service.ts PostgreSQL with pgvector · App.tsx Web application · search.service.ts Vector search · ingestion.processor.ts Transcript worker
Components 25
Learning workspace
- Web application
frontend/src/App.tsx - Dashboard
frontend/src/pages/Dashboard.tsx - Video workspace
frontend/src/pages/Workspace.tsx - Settings
frontend/src/pages/Settings.tsx - API client
frontend/src/lib/api.ts
Identity and keys
- Clerk auth guard
backend/src/auth/clerk-auth.guard.ts - User sync
backend/src/auth/auth.service.ts - API key routes
backend/src/api-keys/api-keys.controller.ts - Encrypted API keys
backend/src/api-keys/api-keys.service.ts
Video ingestion
- Ingestion routes
backend/src/ingestion/ingestion.controller.ts - Ingestion queue
backend/src/ingestion/ingestion.service.ts - Transcript worker
backend/src/ingestion/ingestion.processor.ts
Study features
- Chat routes
backend/src/chat/chat.controller.ts - RAG chat
backend/src/chat/chat.service.ts - Search routes
backend/src/search/search.controller.ts - Vector search
backend/src/search/search.service.ts - Quiz routes
backend/src/quiz/quiz.controller.ts - Quiz generation and results
backend/src/quiz/quiz.service.ts - Video access
backend/src/video/video.service.ts
Persistence and services
- PostgreSQL with pgvector
backend/prisma/prisma.service.ts - Redis and BullMQ
- Google Gemini
- YouTube captions
- Clerk identity
Other components
- Learner
Connections 33
- Learner → Web application: uses
- Web application → Dashboard: routes to
frontend/src/App.tsx - Web application → Video workspace: routes to
frontend/src/App.tsx - Web application → Settings: routes to
frontend/src/App.tsx - Web application → API client: sets up auth
frontend/src/App.tsx - Learner → Ingestion routes: submits URL
- Ingestion routes → Ingestion queue: queues job
backend/src/ingestion/ingestion.controller.ts - Ingestion queue → Redis and BullMQ: adds job
backend/src/ingestion/ingestion.service.ts - Redis and BullMQ → Transcript worker: dispatches job
- Transcript worker → YouTube captions: fetches captions
- Transcript worker → Google Gemini: embeds chunks
- Transcript worker → PostgreSQL with pgvector: stores chunks
backend/src/ingestion/ingestion.processor.ts - Ingestion routes → Learner: streams progress
backend/src/ingestion/ingestion.controller.ts - Learner → Chat routes: asks question
- Chat routes → RAG chat: delegates
backend/src/chat/chat.controller.ts - RAG chat → Vector search: retrieves context
backend/src/chat/chat.service.ts - Vector search → Encrypted API keys: gets key
backend/src/search/search.service.ts - Vector search → Google Gemini: embeds query
backend/src/search/search.service.ts - Vector search → PostgreSQL with pgvector: searches vectors
backend/src/search/search.service.ts - RAG chat → Google Gemini: generates answer
- Learner → Quiz routes: requests quiz
- Quiz routes → Quiz generation and results: delegates
backend/src/quiz/quiz.controller.ts - Quiz generation and results → PostgreSQL with pgvector: reads and saves
backend/src/quiz/quiz.service.ts - Quiz generation and results → Encrypted API keys: gets key
backend/src/quiz/quiz.service.ts - Learner → API key routes: manages keys
- API key routes → Encrypted API keys: delegates
backend/src/api-keys/api-keys.controller.ts - Encrypted API keys → PostgreSQL with pgvector: stores encrypted keys
backend/src/api-keys/api-keys.service.ts - Clerk auth guard → Clerk identity: authenticates request
backend/src/auth/clerk-auth.guard.ts - Clerk auth guard → User sync: syncs user
backend/src/auth/clerk-auth.guard.ts - User sync → PostgreSQL with pgvector: upserts user
backend/src/auth/auth.service.ts - Search routes → Vector search: delegates
backend/src/search/search.controller.ts - Video access → PostgreSQL with pgvector: reads video
backend/src/video/video.service.ts - Video workspace → API client: uses requests