# pankajpatel19/studymate-ai-powered-personal-learning-assistant architecture

> Architecture diagram of the GitHub repository pankajpatel19/studymate-ai-powered-personal-learning-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant
- Repository: https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant

## Overview

StudyMate is a learning web application with study tools, AI-generated learning materials, personal study records, and collaborative rooms. Its typical workflow is a learner using a tool to create or practice material, with server routes handling requests and shared AI, authentication, and storage services supporting the work. The tree documents many distinct capabilities, but their page-to-route wiring is mostly unsampled; those relationships are shown as unverified rather than asserted as calls. The README is the generic Next.js starter README, so feature coverage is based on the source tree and index.

Main entry points: [`app/lib/auth.ts`](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/auth.ts) (Authentication and database), [`app/api/chat/route.ts`](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/chat/route.ts) (AI chat route), [`app/api/quiz/generate/route.ts`](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/quiz/generate/route.ts) (Quiz generation), [`app/lib/ai/bedrock.ts`](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/ai/bedrock.ts) (Bedrock models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Learning experience"]
  node_home["Home and navigation<br/>[page.tsx]"]
  node_accounts["Accounts<br/>[page.tsx]"]
  node_dashboard["Dashboard and progress<br/>[page.tsx]"]
end

subgraph group_learning["Study tools"]
  node_ai_tools["AI study tools<br/>[page.tsx]"]
  node_exams["Exam practice<br/>[page.tsx]"]
  node_quiz["Quiz practice<br/>[page.tsx]"]
  node_flashcards["Flashcard study<br/>[page.tsx]"]
  node_chat_api["AI chat route<br/>[route.ts]"]
  node_quiz_api["Quiz generation<br/>[route.ts]"]
end

subgraph group_collaboration["Study records"]
  node_notes["Notes and cloze<br/>[page.tsx]"]
  node_rooms["Study rooms<br/>[page.tsx]"]
  node_roadmap["Learning roadmap<br/>[page.tsx]"]
  node_focus["Focus sessions<br/>[page.tsx]"]
  node_flashcard_api["Flashcard records<br/>[route.ts]"]
  node_notes_api["Notes records<br/>[route.ts]"]
  node_rooms_api["Room management<br/>[route.ts]"]
end

subgraph group_platform["Platform services"]
  node_auth[("Authentication and database<br/>[auth.ts]")]
  node_ai_model["Bedrock models<br/>[bedrock.ts]"]
  node_vectors[("Pinecone retrieval<br/>[pincone.ts]")]
  node_cache["Response cache<br/>[cache.ts]"]
  node_billing["Premium billing<br/>[useRazorpay.ts]"]
end

node_learner(("Learner"))
node_external_ai{{"AWS Bedrock"}}

node_learner -->|"uses"| node_home
node_learner -.->|"signs in"| node_accounts
node_learner -.->|"tracks study"| node_dashboard
node_learner -.->|"creates materials"| node_ai_tools
node_learner -.->|"practices"| node_exams
node_learner -.->|"practices"| node_quiz
node_learner -.->|"reviews cards"| node_flashcards
node_learner -.->|"writes notes"| node_notes
node_learner -.->|"joins rooms"| node_rooms
node_learner -.->|"plans learning"| node_roadmap
node_learner -.->|"starts focus"| node_focus
node_chat_api -->|"checks session"| node_auth
node_chat_api -->|"retrieves context"| node_vectors
node_chat_api -->|"invokes model"| node_ai_model
node_quiz_api -->|"checks session"| node_auth
node_quiz_api -->|"searches content"| node_vectors
node_quiz_api -->|"invokes model"| node_ai_model
node_flashcard_api -->|"reads and invalidates"| node_cache
node_flashcard_api -.->|"checks session"| node_auth
node_notes_api -->|"reads and invalidates"| node_cache
node_notes_api -->|"checks session"| node_auth
node_rooms_api -->|"reads and invalidates"| node_cache
node_rooms_api -.->|"checks session"| node_auth
node_ai_model -.->|"calls models"| node_external_ai
node_learner -.->|"upgrades"| node_billing

click node_home "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/page.tsx"
click node_accounts "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/(auth)/login/page.tsx"
click node_dashboard "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/dashboard/page.tsx"
click node_ai_tools "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/essay/page.tsx"
click node_exams "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/exam/page.tsx"
click node_quiz "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/quiz/page.tsx"
click node_flashcards "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/flashcards/page.tsx"
click node_notes "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/notes/page.tsx"
click node_rooms "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/rooms/%5BroomId%5D/page.tsx"
click node_roadmap "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/roadmap/page.tsx"
click node_focus "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/focus/page.tsx"
click node_chat_api "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/chat/route.ts"
click node_quiz_api "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/quiz/generate/route.ts"
click node_flashcard_api "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/flashcards/route.ts"
click node_notes_api "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/notes/route.ts"
click node_rooms_api "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/rooms/route.ts"
click node_auth "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/auth.ts"
click node_ai_model "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/ai/bedrock.ts"
click node_vectors "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/vectors/pincone.ts"
click node_cache "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/utils/cache.ts"
click node_billing "https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/hooks/useRazorpay.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_home,node_accounts,node_dashboard toneBlue
class node_ai_tools,node_exams,node_quiz,node_flashcards,node_chat_api,node_quiz_api toneAmber
class node_notes,node_rooms,node_roadmap,node_focus,node_flashcard_api,node_notes_api,node_rooms_api toneMint
class node_auth,node_ai_model,node_vectors,node_cache,node_billing toneRose
class node_learner,node_external_ai toneIndigo
```

## Components

### Learning experience

- [Home and navigation](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/page.tsx): `app/page.tsx`
- [Accounts](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/(auth)/login/page.tsx): `app/(view)/(auth)/login/page.tsx`
- [Dashboard and progress](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/dashboard/page.tsx): `app/(view)/dashboard/page.tsx`

### Study tools

- [AI study tools](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/essay/page.tsx): `app/(view)/essay/page.tsx`
- [Exam practice](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/exam/page.tsx): `app/(view)/exam/page.tsx`
- [Quiz practice](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/quiz/page.tsx): `app/(view)/quiz/page.tsx`
- [Flashcard study](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/flashcards/page.tsx): `app/(view)/flashcards/page.tsx`
- [AI chat route](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`
- [Quiz generation](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/quiz/generate/route.ts): `app/api/quiz/generate/route.ts`

### Study records

- [Notes and cloze](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/notes/page.tsx): `app/(view)/notes/page.tsx`
- [Study rooms](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/rooms/%5BroomId%5D/page.tsx): `app/(view)/rooms/[roomId]/page.tsx`
- [Learning roadmap](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/roadmap/page.tsx): `app/(view)/roadmap/page.tsx`
- [Focus sessions](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/(view)/focus/page.tsx): `app/(view)/focus/page.tsx`
- [Flashcard records](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/flashcards/route.ts): `app/api/flashcards/route.ts`
- [Notes records](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/notes/route.ts): `app/api/notes/route.ts`
- [Room management](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/api/rooms/route.ts): `app/api/rooms/route.ts`

### Platform services

- [Authentication and database](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/auth.ts): `app/lib/auth.ts`
- [Bedrock models](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/ai/bedrock.ts): `app/lib/ai/bedrock.ts`
- [Pinecone retrieval](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/vectors/pincone.ts): `app/lib/vectors/pincone.ts`
- [Response cache](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/utils/cache.ts): `app/lib/utils/cache.ts`
- [Premium billing](https://github.com/pankajpatel19/studymate-ai-powered-personal-learning-assistant/blob/main/app/lib/hooks/useRazorpay.ts): `app/lib/hooks/useRazorpay.ts`

### Other components

- **Learner**
- **AWS Bedrock**

## Connections

- Learner → Home and navigation: uses (evidence: `app/page.tsx`)
- Learner → Accounts: signs in
- Learner → Dashboard and progress: tracks study
- Learner → AI study tools: creates materials
- Learner → Exam practice: practices
- Learner → Quiz practice: practices
- Learner → Flashcard study: reviews cards
- Learner → Notes and cloze: writes notes
- Learner → Study rooms: joins rooms
- Learner → Learning roadmap: plans learning
- Learner → Focus sessions: starts focus
- AI chat route → Authentication and database: checks session (evidence: `app/api/chat/route.ts`)
- AI chat route → Pinecone retrieval: retrieves context (evidence: `app/api/chat/route.ts`)
- AI chat route → Bedrock models: invokes model (evidence: `app/api/chat/route.ts`)
- Quiz generation → Authentication and database: checks session (evidence: `app/api/quiz/generate/route.ts`)
- Quiz generation → Pinecone retrieval: searches content (evidence: `app/api/quiz/generate/route.ts`)
- Quiz generation → Bedrock models: invokes model (evidence: `app/api/quiz/generate/route.ts`)
- Flashcard records → Response cache: reads and invalidates (evidence: `app/api/flashcards/route.ts`)
- Flashcard records → Authentication and database: checks session (evidence: `app/api/flashcards/route.ts`)
- Notes records → Response cache: reads and invalidates (evidence: `app/api/notes/route.ts`)
- Notes records → Authentication and database: checks session (evidence: `app/api/notes/route.ts`)
- Room management → Response cache: reads and invalidates (evidence: `app/api/rooms/route.ts`)
- Room management → Authentication and database: checks session (evidence: `app/api/rooms/route.ts`)
- Bedrock models → AWS Bedrock: calls models
- Learner → Premium billing: upgrades
