# nissankararaothanvitha/masterprep architecture

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

- Interactive diagram: https://gitdiagram.com/nissankararaothanvitha/masterprep
- Repository: https://github.com/nissankararaothanvitha/masterprep

## Overview

MasterPrep is an AI-assisted interview-preparation platform. Students sign in to browse subject questions and bookmarks, take timed quizzes, review progress and daily challenges, ask AI doubts, or complete a graded mock interview. The React app routes these activities through a shared authenticated API client to FastAPI, whose feature routers use SQLAlchemy-backed domain records and AI grading/chat services. The README documents the major capabilities; some router and frontend links are based on the source index, so unsampled internal calls are not expanded.

Main entry points: [`MasterPrep-main/src/App.jsx`](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/App.jsx) (App routing), [`MasterPrep-main/src/api.js`](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/api.js) (API client), [`MasterPrep-back/main.py`](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/main.py) (FastAPI app), [`MasterPrep-back/models.py`](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/models.py) (Domain records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student app"]
  node_app["App routing<br/>[App.jsx]"]
  node_client_auth["Auth context<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_identity["Identity"]
  node_auth_pages["Login and register<br/>[Login.jsx]"]
  node_auth_service["Authentication<br/>[auth.py]"]
end

subgraph group_learning["Learning activities"]
  node_questions_ui["Question browser<br/>[Questions.jsx]"]
  node_bookmarks_ui["Bookmarks<br/>[Bookmarks.jsx]"]
  node_quiz_ui["Quiz flow<br/>[Quiz.jsx]"]
  node_quiz_setup["Quiz setup<br/>[QuizSetup.jsx]"]
  node_questions_api["Question bank<br/>[questions.py]"]
  node_quiz_api["Timed quizzes<br/>[quizzes.py]"]
  node_daily_ui["Daily review<br/>[DailyReview.jsx]"]
  node_daily_api["Daily challenge<br/>[daily.py]"]
end

subgraph group_insights["Progress and AI"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_analytics_api["Performance analytics<br/>[analytics.py]"]
  node_interview_setup["Interview setup<br/>[InterviewSetup.jsx]"]
  node_interview_ui["Interview session<br/>[Interview.jsx]"]
  node_interviews_api["Mock interviews<br/>[interviews.py]"]
  node_chat_ui["Doubt chat<br/>[AIDoubtChat.jsx]"]
  node_chats_api["AI chat<br/>[chats.py]"]
  node_ai_service["Gemini services<br/>[ai.py]"]
end

subgraph group_platform["API and data"]
  node_backend["FastAPI app<br/>[main.py]"]
  node_orm_models["Domain records<br/>[models.py]"]
  node_db_config["Database sessions<br/>[database.py]"]
  node_database[("SQL database")]
  node_schemas["Domain types<br/>[schemas.py]"]
end

node_student(("Student"))
node_backend_host{{"Backend service"}}

node_student -->|"uses"| node_app
node_app -->|"routes to"| node_auth_pages
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_questions_ui
node_app -->|"routes to"| node_bookmarks_ui
node_app -->|"routes to"| node_quiz_setup
node_app -->|"routes to"| node_quiz_ui
node_app -->|"routes to"| node_daily_ui
node_app -->|"routes to"| node_interview_setup
node_app -->|"routes to"| node_interview_ui
node_app -->|"routes to"| node_chat_ui
node_auth_pages -->|"uses auth"| node_client_auth
node_client_auth -->|"calls"| node_api_client
node_auth_pages -->|"calls"| node_api_client
node_questions_ui -->|"requests data"| node_api_client
node_bookmarks_ui -->|"requests data"| node_api_client
node_quiz_setup -->|"starts quiz"| node_api_client
node_quiz_ui -->|"submits answers"| node_api_client
node_daily_ui -->|"loads review"| node_api_client
node_dashboard -->|"loads metrics"| node_api_client
node_interview_setup -->|"starts session"| node_api_client
node_interview_ui -->|"submits answers"| node_api_client
node_chat_ui -->|"sends messages"| node_api_client
node_api_client -->|"HTTP requests"| node_backend_host
node_backend_host -->|"served by"| node_backend
node_backend -->|"registers router"| node_auth_service
node_backend -->|"registers router"| node_questions_api
node_backend -->|"registers router"| node_quiz_api
node_backend -->|"registers router"| node_daily_api
node_backend -->|"registers router"| node_chats_api
node_backend -->|"registers router"| node_analytics_api
node_backend -->|"registers router"| node_interviews_api
node_auth_service -->|"uses sessions"| node_db_config
node_auth_service -->|"queries users"| node_orm_models
node_questions_api -->|"uses sessions"| node_db_config
node_questions_api -->|"reads and writes"| node_orm_models
node_quiz_api -->|"uses sessions"| node_db_config
node_quiz_api -->|"reads and writes"| node_orm_models
node_daily_api -->|"uses sessions"| node_db_config
node_daily_api -->|"reads and writes"| node_orm_models
node_analytics_api -->|"uses sessions"| node_db_config
node_analytics_api -->|"queries records"| node_orm_models
node_interviews_api -->|"uses sessions"| node_db_config
node_interviews_api -->|"reads and writes"| node_orm_models
node_interviews_api -->|"grades answers"| node_ai_service
node_chats_api -->|"uses sessions"| node_db_config
node_chats_api -->|"reads and writes"| node_orm_models
node_chats_api -->|"requests replies"| node_ai_service

click node_app "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/App.jsx"
click node_client_auth "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/AuthContext.jsx"
click node_api_client "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/api.js"
click node_auth_pages "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Login.jsx"
click node_auth_service "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/auth.py"
click node_questions_ui "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Questions.jsx"
click node_bookmarks_ui "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Bookmarks.jsx"
click node_quiz_ui "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Quiz.jsx"
click node_quiz_setup "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/QuizSetup.jsx"
click node_questions_api "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/questions.py"
click node_quiz_api "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/quizzes.py"
click node_daily_ui "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/DailyReview.jsx"
click node_daily_api "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/daily.py"
click node_dashboard "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Dashboard.jsx"
click node_analytics_api "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/analytics.py"
click node_interview_setup "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/InterviewSetup.jsx"
click node_interview_ui "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Interview.jsx"
click node_interviews_api "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/interviews.py"
click node_chat_ui "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/AIDoubtChat.jsx"
click node_chats_api "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/chats.py"
click node_ai_service "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/ai.py"
click node_backend "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/main.py"
click node_orm_models "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/models.py"
click node_db_config "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/database.py"
click node_schemas "https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/schemas.py"

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_client_auth,node_api_client toneBlue
class node_auth_pages,node_auth_service toneAmber
class node_questions_ui,node_bookmarks_ui,node_quiz_ui,node_quiz_setup,node_questions_api,node_quiz_api,node_daily_ui,node_daily_api toneMint
class node_dashboard,node_analytics_api,node_interview_setup,node_interview_ui,node_interviews_api,node_chat_ui,node_chats_api,node_ai_service toneRose
class node_backend,node_orm_models,node_db_config,node_database,node_schemas,node_student,node_backend_host toneIndigo
```

## Components

### Student app

- [App routing](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/App.jsx): `MasterPrep-main/src/App.jsx`
- [Auth context](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/AuthContext.jsx): `MasterPrep-main/src/AuthContext.jsx`
- [API client](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/api.js): `MasterPrep-main/src/api.js`

### Identity

- [Login and register](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Login.jsx): `MasterPrep-main/src/pages/Login.jsx`
- [Authentication](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/auth.py): `MasterPrep-back/auth.py`

### Learning activities

- [Question browser](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Questions.jsx): `MasterPrep-main/src/pages/Questions.jsx`
- [Bookmarks](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Bookmarks.jsx): `MasterPrep-main/src/pages/Bookmarks.jsx`
- [Quiz flow](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Quiz.jsx): `MasterPrep-main/src/pages/Quiz.jsx`
- [Quiz setup](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/QuizSetup.jsx): `MasterPrep-main/src/pages/QuizSetup.jsx`
- [Question bank](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/questions.py): `MasterPrep-back/routers/questions.py`
- [Timed quizzes](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/quizzes.py): `MasterPrep-back/routers/quizzes.py`
- [Daily review](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/DailyReview.jsx): `MasterPrep-main/src/pages/DailyReview.jsx`
- [Daily challenge](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/daily.py): `MasterPrep-back/routers/daily.py`

### Progress and AI

- [Dashboard](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Dashboard.jsx): `MasterPrep-main/src/pages/Dashboard.jsx`
- [Performance analytics](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/analytics.py): `MasterPrep-back/routers/analytics.py`
- [Interview setup](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/InterviewSetup.jsx): `MasterPrep-main/src/pages/InterviewSetup.jsx`
- [Interview session](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/Interview.jsx): `MasterPrep-main/src/pages/Interview.jsx`
- [Mock interviews](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/interviews.py): `MasterPrep-back/routers/interviews.py`
- [Doubt chat](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-main/src/pages/AIDoubtChat.jsx): `MasterPrep-main/src/pages/AIDoubtChat.jsx`
- [AI chat](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/routers/chats.py): `MasterPrep-back/routers/chats.py`
- [Gemini services](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/ai.py): `MasterPrep-back/ai.py`

### API and data

- [FastAPI app](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/main.py): `MasterPrep-back/main.py`
- [Domain records](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/models.py): `MasterPrep-back/models.py`
- [Database sessions](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/database.py): `MasterPrep-back/database.py`
- **SQL database**
- [Domain types](https://github.com/nissankararaothanvitha/masterprep/blob/main/MasterPrep-back/schemas.py): `MasterPrep-back/schemas.py`

### Other components

- **Student**
- **Backend service**

## Connections

- Student → App routing: uses (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Login and register: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Question browser: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Bookmarks: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Quiz setup: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Quiz flow: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Daily review: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Interview setup: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Interview session: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- App routing → Doubt chat: routes to (evidence: `MasterPrep-main/src/App.jsx`)
- Login and register → Auth context: uses auth (evidence: `MasterPrep-main/src/pages/Login.jsx`)
- Auth context → API client: calls (evidence: `MasterPrep-main/src/AuthContext.jsx`)
- Login and register → API client: calls (evidence: `MasterPrep-main/src/pages/Login.jsx`)
- Question browser → API client: requests data (evidence: `MasterPrep-main/src/pages/Questions.jsx`)
- Bookmarks → API client: requests data (evidence: `MasterPrep-main/src/pages/Bookmarks.jsx`)
- Quiz setup → API client: starts quiz (evidence: `MasterPrep-main/src/pages/QuizSetup.jsx`)
- Quiz flow → API client: submits answers (evidence: `MasterPrep-main/src/pages/Quiz.jsx`)
- Daily review → API client: loads review (evidence: `MasterPrep-main/src/pages/DailyReview.jsx`)
- Dashboard → API client: loads metrics (evidence: `MasterPrep-main/src/pages/Dashboard.jsx`)
- Interview setup → API client: starts session (evidence: `MasterPrep-main/src/pages/InterviewSetup.jsx`)
- Interview session → API client: submits answers (evidence: `MasterPrep-main/src/pages/Interview.jsx`)
- Doubt chat → API client: sends messages (evidence: `MasterPrep-main/src/pages/AIDoubtChat.jsx`)
- API client → Backend service: HTTP requests (evidence: `README.md`)
- Backend service → FastAPI app: served by (evidence: `README.md`)
- FastAPI app → Authentication: registers router (evidence: `MasterPrep-back/main.py`)
- FastAPI app → Question bank: registers router (evidence: `MasterPrep-back/main.py`)
- FastAPI app → Timed quizzes: registers router (evidence: `MasterPrep-back/main.py`)
- FastAPI app → Daily challenge: registers router (evidence: `MasterPrep-back/main.py`)
- FastAPI app → AI chat: registers router (evidence: `MasterPrep-back/main.py`)
- FastAPI app → Performance analytics: registers router (evidence: `MasterPrep-back/main.py`)
- FastAPI app → Mock interviews: registers router (evidence: `MasterPrep-back/main.py`)
- Authentication → Database sessions: uses sessions (evidence: `MasterPrep-back/auth.py`)
- Authentication → Domain records: queries users (evidence: `MasterPrep-back/auth.py`)
- Question bank → Database sessions: uses sessions (evidence: `MasterPrep-back/routers/questions.py`)
- Question bank → Domain records: reads and writes (evidence: `MasterPrep-back/routers/questions.py`)
- Timed quizzes → Database sessions: uses sessions (evidence: `MasterPrep-back/routers/quizzes.py`)
- Timed quizzes → Domain records: reads and writes (evidence: `MasterPrep-back/routers/quizzes.py`)
- Daily challenge → Database sessions: uses sessions (evidence: `MasterPrep-back/routers/daily.py`)
- Daily challenge → Domain records: reads and writes (evidence: `MasterPrep-back/routers/daily.py`)
- Performance analytics → Database sessions: uses sessions (evidence: `MasterPrep-back/routers/analytics.py`)
- Performance analytics → Domain records: queries records (evidence: `MasterPrep-back/routers/analytics.py`)
- Mock interviews → Database sessions: uses sessions (evidence: `MasterPrep-back/routers/interviews.py`)
- Mock interviews → Domain records: reads and writes (evidence: `MasterPrep-back/routers/interviews.py`)
- Mock interviews → Gemini services: grades answers (evidence: `MasterPrep-back/routers/interviews.py`)
- AI chat → Database sessions: uses sessions (evidence: `MasterPrep-back/routers/chats.py`)
- AI chat → Domain records: reads and writes (evidence: `MasterPrep-back/routers/chats.py`)
- AI chat → Gemini services: requests replies (evidence: `MasterPrep-back/routers/chats.py`)
