# vishnukaribandi25-spec/studyrag architecture

> Architecture diagram of the GitHub repository vishnukaribandi25-spec/studyrag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vishnukaribandi25-spec/studyrag
- Repository: https://github.com/vishnukaribandi25-spec/studyrag

## Overview

This is a browser-based PDF study assistant. Users upload a PDF, then explore generated questions and answers, chat with the document, request a summary, and revisit saved chats. The layout coordinates these views and the assistant hook manages document and conversation state while invoking Supabase functions. The function modules indicate separate processing and generation capabilities; their internal behavior and some frontend-to-function calls were not shown, so those links are marked unverified where needed.

Main entry points: [`src/components/StudyLayout.tsx`](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/StudyLayout.tsx) (Study layout), [`src/hooks/useStudyAssistant.ts`](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/hooks/useStudyAssistant.ts) (Assistant state), [`src/components/SummaryView.tsx`](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/SummaryView.tsx) (Summary view), [`src/components/QuestionsView.tsx`](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/QuestionsView.tsx) (Questions view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_app["App routing<br/>[App.tsx]"]
  node_study_layout["Study layout<br/>[StudyLayout.tsx]"]
  node_dashboard["Study dashboard<br/>[Dashboard.tsx]"]
  node_sidebar["App sidebar<br/>[AppSidebar.tsx]"]
end

subgraph group_study["Study workflows"]
  node_upload_ui["PDF upload<br/>[PdfUpload.tsx]"]
  node_assistant_state["Assistant state"]
  node_pdf_extract["PDF text extraction<br/>[pdfUtils.ts]"]
  node_questions_view["Questions view<br/>[QuestionsView.tsx]"]
  node_question_list["Question list<br/>[QuestionList.tsx]"]
  node_answer_panel["Answer panel<br/>[AnswerPanel.tsx]"]
  node_chat_view["Chat view<br/>[ChatView.tsx]"]
  node_chat_panel["Chat panel<br/>[ChatPanel.tsx]"]
  node_summary_view["Summary view<br/>[SummaryView.tsx]"]
  node_saved_chats["Saved chats<br/>[SavedChats.tsx]"]
  node_chat_history[("Chat history<br/>[useChatHistory.ts]")]
end

subgraph group_backend["Supabase services"]
  node_supabase["Supabase client<br/>[client.ts]"]
  node_pdf_function["PDF processing<br/>[index.ts]"]
  node_questions_function["Question generation<br/>[index.ts]"]
  node_answer_function["Answer generation<br/>[index.ts]"]
  node_chat_function["Document chat<br/>[index.ts]"]
  node_summary_function["PDF summarization<br/>[index.ts]"]
end

subgraph group_support["Client support"]
  node_typing["Typing animation"]
end

node_learner(("Learner"))

node_learner -->|"opens"| node_app
node_app -->|"routes to"| node_study_layout
node_study_layout -->|"uses"| node_assistant_state
node_study_layout -->|"renders"| node_upload_ui
node_study_layout -->|"renders"| node_dashboard
node_study_layout -->|"renders"| node_sidebar
node_study_layout -->|"renders"| node_questions_view
node_study_layout -->|"renders"| node_chat_view
node_study_layout -->|"renders"| node_summary_view
node_study_layout -->|"renders"| node_saved_chats
node_study_layout -->|"uses"| node_chat_history
node_questions_view -->|"renders"| node_question_list
node_questions_view -->|"renders"| node_answer_panel
node_chat_view -->|"renders"| node_chat_panel
node_upload_ui -->|"submits PDF"| node_assistant_state
node_assistant_state -->|"extracts text"| node_pdf_extract
node_assistant_state -->|"invokes functions"| node_supabase
node_summary_view -->|"invokes summary"| node_supabase
node_summary_view -->|"animates text"| node_typing
node_answer_panel -->|"animates answer"| node_typing
node_chat_history -->|"uses chat type"| node_saved_chats
node_assistant_state -.->|"calls processing"| node_pdf_function
node_assistant_state -.->|"invokes generation"| node_questions_function
node_assistant_state -.->|"requests answer"| node_answer_function
node_assistant_state -.->|"streams chat"| node_chat_function
node_summary_view -.->|"requests summary"| node_summary_function

click node_app "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/App.tsx"
click node_study_layout "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/StudyLayout.tsx"
click node_dashboard "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/Dashboard.tsx"
click node_sidebar "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/AppSidebar.tsx"
click node_upload_ui "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/PdfUpload.tsx"
click node_assistant_state "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/hooks/useStudyAssistant.ts"
click node_pdf_extract "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/lib/pdfUtils.ts"
click node_questions_view "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/QuestionsView.tsx"
click node_question_list "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/QuestionList.tsx"
click node_answer_panel "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/AnswerPanel.tsx"
click node_chat_view "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/ChatView.tsx"
click node_chat_panel "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/ChatPanel.tsx"
click node_summary_view "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/SummaryView.tsx"
click node_saved_chats "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/SavedChats.tsx"
click node_chat_history "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/hooks/useChatHistory.ts"
click node_supabase "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/integrations/supabase/client.ts"
click node_pdf_function "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/process-pdf/index.ts"
click node_questions_function "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/generate-questions/index.ts"
click node_answer_function "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/generate-answer/index.ts"
click node_chat_function "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/chat/index.ts"
click node_summary_function "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/summarize-pdf/index.ts"
click node_typing "https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/hooks/useTypingAnimation.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_study_layout,node_dashboard,node_sidebar toneBlue
class node_upload_ui,node_assistant_state,node_pdf_extract,node_questions_view,node_question_list,node_answer_panel,node_chat_view,node_chat_panel,node_summary_view,node_saved_chats,node_chat_history toneAmber
class node_supabase,node_pdf_function,node_questions_function,node_answer_function,node_chat_function,node_summary_function toneMint
class node_typing toneRose
class node_learner toneIndigo
```

## Components

### Application UI

- [App routing](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/App.tsx): `src/App.tsx`
- [Study layout](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/StudyLayout.tsx): `src/components/StudyLayout.tsx`
- [Study dashboard](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [App sidebar](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/AppSidebar.tsx): `src/components/AppSidebar.tsx`

### Study workflows

- [PDF upload](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/PdfUpload.tsx): `src/components/PdfUpload.tsx`
- [Assistant state](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/hooks/useStudyAssistant.ts): `src/hooks/useStudyAssistant.ts`
- [PDF text extraction](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/lib/pdfUtils.ts): `src/lib/pdfUtils.ts`
- [Questions view](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/QuestionsView.tsx): `src/components/QuestionsView.tsx`
- [Question list](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/QuestionList.tsx): `src/components/QuestionList.tsx`
- [Answer panel](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/AnswerPanel.tsx): `src/components/AnswerPanel.tsx`
- [Chat view](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/ChatView.tsx): `src/components/ChatView.tsx`
- [Chat panel](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/ChatPanel.tsx): `src/components/ChatPanel.tsx`
- [Summary view](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/SummaryView.tsx): `src/components/SummaryView.tsx`
- [Saved chats](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/components/SavedChats.tsx): `src/components/SavedChats.tsx`
- [Chat history](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/hooks/useChatHistory.ts): `src/hooks/useChatHistory.ts`

### Supabase services

- [Supabase client](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [PDF processing](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/process-pdf/index.ts): `supabase/functions/process-pdf/index.ts`
- [Question generation](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/generate-questions/index.ts): `supabase/functions/generate-questions/index.ts`
- [Answer generation](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/generate-answer/index.ts): `supabase/functions/generate-answer/index.ts`
- [Document chat](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/chat/index.ts): `supabase/functions/chat/index.ts`
- [PDF summarization](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/supabase/functions/summarize-pdf/index.ts): `supabase/functions/summarize-pdf/index.ts`

### Client support

- [Typing animation](https://github.com/vishnukaribandi25-spec/studyrag/blob/main/src/hooks/useTypingAnimation.ts): `src/hooks/useTypingAnimation.ts`

### Other components

- **Learner**

## Connections

- Learner → App routing: opens (evidence: `src/App.tsx`)
- App routing → Study layout: routes to
- Study layout → Assistant state: uses (evidence: `src/components/StudyLayout.tsx`)
- Study layout → PDF upload: renders (evidence: `src/components/StudyLayout.tsx`)
- Study layout → Study dashboard: renders (evidence: `src/components/StudyLayout.tsx`)
- Study layout → App sidebar: renders (evidence: `src/components/StudyLayout.tsx`)
- Study layout → Questions view: renders (evidence: `src/components/StudyLayout.tsx`)
- Study layout → Chat view: renders (evidence: `src/components/StudyLayout.tsx`)
- Study layout → Summary view: renders (evidence: `src/components/StudyLayout.tsx`)
- Study layout → Saved chats: renders (evidence: `src/components/StudyLayout.tsx`)
- Study layout → Chat history: uses (evidence: `src/components/StudyLayout.tsx`)
- Questions view → Question list: renders (evidence: `src/components/QuestionsView.tsx`)
- Questions view → Answer panel: renders (evidence: `src/components/QuestionsView.tsx`)
- Chat view → Chat panel: renders (evidence: `src/components/ChatView.tsx`)
- PDF upload → Assistant state: submits PDF (evidence: `src/components/StudyLayout.tsx`)
- Assistant state → PDF text extraction: extracts text (evidence: `src/hooks/useStudyAssistant.ts`)
- Assistant state → Supabase client: invokes functions (evidence: `src/hooks/useStudyAssistant.ts`)
- Summary view → Supabase client: invokes summary (evidence: `src/components/SummaryView.tsx`)
- Summary view → Typing animation: animates text (evidence: `src/components/SummaryView.tsx`)
- Answer panel → Typing animation: animates answer (evidence: `src/components/AnswerPanel.tsx`)
- Chat history → Saved chats: uses chat type (evidence: `src/hooks/useChatHistory.ts`)
- Assistant state → PDF processing: calls processing
- Assistant state → Question generation: invokes generation
- Assistant state → Answer generation: requests answer
- Assistant state → Document chat: streams chat
- Summary view → PDF summarization: requests summary
