# etcharlarevanthrao/cs_assistant architecture

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

- Interactive diagram: https://gitdiagram.com/etcharlarevanthrao/cs_assistant
- Repository: https://github.com/etcharlarevanthrao/cs_assistant

## Overview

CS Assistant is a cross-platform study and productivity assistant: learners use web, desktop, or mobile clients to access AI chat, learning tools, and exam practice through a FastAPI backend. A typical chat request travels from a client API to a backend route, where retrieval-augmented generation can provide an answer; the backend also supports PYQ practice, research, planning, and other study features. Firebase authentication and Firestore-backed user data support the product. Several feature routes are unsampled, so their internal calls are not drawn; broader client-to-backend connectivity is documented in the README.

Main entry points: [`backend/app/main.py`](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/main.py) (FastAPI entry), [`backend/app/routes/chat.py`](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/chat.py) (AI chat), [`backend/app/core/rag.py`](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/rag.py) (RAG engine), [`backend/app/routes/resume.py`](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/resume.py) (Resume builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client apps"]
  node_webapp["Web app<br/>[App.tsx]"]
  node_webapi["Web API client<br/>[api.ts]"]
  node_mobileapp["Mobile app<br/>[AppNavigator.tsx]"]
  node_mobileapi["Mobile API client<br/>[api.ts]"]
end

subgraph group_backend["API and AI"]
  node_backendentry["FastAPI entry<br/>[main.py]"]
  node_chatroute["AI chat<br/>[chat.py]"]
  node_rag["RAG engine<br/>[rag.py]"]
  node_vector["Vector retrieval<br/>[vectorstore.py]"]
end

subgraph group_study["Study features"]
  node_learning["Learning tools<br/>[learning.py]"]
  node_pyq["Exam practice<br/>[pyq.py]"]
  node_research["Research<br/>[research.py]"]
  node_resume["Resume builder<br/>[resume.py]"]
  node_otherfeatures["Other study features"]
end

subgraph group_platform["Identity and data"]
  node_authui["Client identity<br/>[AuthContext.tsx]"]
  node_authservice["Token verification<br/>[auth.py]"]
  node_firestore[("User data")]
  node_usage["Usage limits<br/>[usage_service.py]"]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_webapp
node_learner -->|"uses"| node_mobileapp
node_webapp -.->|"requests via"| node_webapi
node_mobileapp -.->|"requests via"| node_mobileapi
node_webapi -->|"calls API"| node_backendentry
node_mobileapi -->|"calls API"| node_backendentry
node_backendentry -->|"registers"| node_chatroute
node_backendentry -->|"registers"| node_learning
node_backendentry -->|"registers"| node_pyq
node_backendentry -->|"registers"| node_research
node_backendentry -->|"registers"| node_resume
node_backendentry -.->|"registers routes"| node_otherfeatures
node_chatroute -->|"invokes"| node_rag
node_rag -->|"retrieves from"| node_vector
node_chatroute -->|"verifies user"| node_authservice
node_chatroute -->|"checks limits"| node_usage
node_usage -->|"reads and writes"| node_firestore
node_research -->|"uses retrieval"| node_rag
node_resume -->|"uses retrieval"| node_rag
node_resume -->|"persists data"| node_firestore
node_authui -->|"provides identity"| node_webapp

click node_webapp "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-web/src/App.tsx"
click node_webapi "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-web/src/services/api.ts"
click node_mobileapp "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-mobile/src/navigation/AppNavigator.tsx"
click node_mobileapi "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-mobile/src/services/api.ts"
click node_backendentry "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/main.py"
click node_chatroute "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/chat.py"
click node_rag "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/rag.py"
click node_vector "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/vectorstore.py"
click node_learning "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/learning.py"
click node_pyq "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/pyq.py"
click node_research "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/research.py"
click node_resume "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/resume.py"
click node_otherfeatures "https://github.com/etcharlarevanthrao/cs_assistant/tree/main/backend/app/routes"
click node_authui "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-web/src/context/AuthContext.tsx"
click node_authservice "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/auth.py"
click node_firestore "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/firestore_service.py"
click node_usage "https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/usage_service.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_webapp,node_webapi,node_mobileapp,node_mobileapi toneBlue
class node_backendentry,node_chatroute,node_rag,node_vector toneAmber
class node_learning,node_pyq,node_research,node_resume,node_otherfeatures toneMint
class node_authui,node_authservice,node_firestore,node_usage toneRose
class node_learner toneIndigo
```

## Components

### Client apps

- [Web app](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-web/src/App.tsx): `frontend-web/src/App.tsx`
- [Web API client](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-web/src/services/api.ts): `frontend-web/src/services/api.ts`
- [Mobile app](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-mobile/src/navigation/AppNavigator.tsx): `frontend-mobile/src/navigation/AppNavigator.tsx`
- [Mobile API client](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-mobile/src/services/api.ts): `frontend-mobile/src/services/api.ts`

### API and AI

- [FastAPI entry](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/main.py): `backend/app/main.py`
- [AI chat](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/chat.py): `backend/app/routes/chat.py`
- [RAG engine](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/rag.py): `backend/app/core/rag.py`
- [Vector retrieval](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/vectorstore.py): `backend/app/core/vectorstore.py`

### Study features

- [Learning tools](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/learning.py): `backend/app/routes/learning.py`
- [Exam practice](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/pyq.py): `backend/app/routes/pyq.py`
- [Research](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/research.py): `backend/app/routes/research.py`
- [Resume builder](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/routes/resume.py): `backend/app/routes/resume.py`
- [Other study features](https://github.com/etcharlarevanthrao/cs_assistant/tree/main/backend/app/routes): `backend/app/routes`

### Identity and data

- [Client identity](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/frontend-web/src/context/AuthContext.tsx): `frontend-web/src/context/AuthContext.tsx`
- [Token verification](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/auth.py): `backend/app/core/auth.py`
- [User data](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/firestore_service.py): `backend/app/core/firestore_service.py`
- [Usage limits](https://github.com/etcharlarevanthrao/cs_assistant/blob/main/backend/app/core/usage_service.py): `backend/app/core/usage_service.py`

### Other components

- **Learner**

## Connections

- Learner → Web app: uses (evidence: `README.md`)
- Learner → Mobile app: uses (evidence: `README.md`)
- Web app → Web API client: requests via
- Mobile app → Mobile API client: requests via
- Web API client → FastAPI entry: calls API (evidence: `README.md`)
- Mobile API client → FastAPI entry: calls API (evidence: `README.md`)
- FastAPI entry → AI chat: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Learning tools: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Exam practice: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Research: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Resume builder: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Other study features: registers routes (evidence: `backend/app/main.py`)
- AI chat → RAG engine: invokes (evidence: `backend/app/routes/chat.py`)
- RAG engine → Vector retrieval: retrieves from (evidence: `backend/app/core/rag.py`)
- AI chat → Token verification: verifies user (evidence: `backend/app/routes/chat.py`)
- AI chat → Usage limits: checks limits (evidence: `backend/app/routes/chat.py`)
- Usage limits → User data: reads and writes (evidence: `backend/app/core/usage_service.py`)
- Research → RAG engine: uses retrieval (evidence: `backend/app/routes/research.py`)
- Resume builder → RAG engine: uses retrieval (evidence: `backend/app/routes/resume.py`)
- Resume builder → User data: persists data (evidence: `backend/app/routes/resume.py`)
- Client identity → Web app: provides identity (evidence: `frontend-web/src/App.tsx`)
