# shayantan1012/gatemind-ai architecture

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

- Interactive diagram: https://gitdiagram.com/shayantan1012/gatemind-ai
- Repository: https://github.com/shayantan1012/gatemind-ai

## Overview

GATEMIND-AI is a GATE-preparation platform combining student accounts and profiles, evaluated mock exams, personalized performance analysis, document-grounded study chat, and an administration workspace. The principal student flow runs from the React portal through Flask endpoints to application services and persistent data; mock-test submissions yield scores and subject insights, while study-material uploads are indexed for cited chat answers. The graph preserves documented admin and AI capabilities. Some subsystem links rely on README architecture because their implementations were not sampled.

Main entry points: [`frontend/src/lib/api.js`](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/lib/api.js) (API Client), [`frontend/src/App.jsx`](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/App.jsx) (Portal App), [`backend/app/services/rag/indexing/indexing_pipeline.py`](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/indexing/indexing_pipeline.py) (Document Indexer), [`backend/app/services/rag/rag_chat_service.py`](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/rag_chat_service.py) (RAG Chat Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Student and Admin UI"]
  node_app["Portal App<br/>[App.jsx]"]
  node_auth_ui["Auth Panel<br/>[AuthPanel.jsx]"]
  node_profile_ui["Profile Panel<br/>[ProfilePanel.jsx]"]
  node_test_ui["Mock Test Panel<br/>[MockTestPanel.jsx]"]
  node_rag_ui["RAG Panel<br/>[RagPanel.jsx]"]
  node_admin_ui["Admin Panel<br/>[AdminPanel.jsx]"]
  node_api_client["API Client<br/>[api.js]"]
end

subgraph group_identity["Identity and Profiles"]
  node_auth_controller["Auth Controller<br/>[auth_controller.py]"]
  node_auth_service["Authentication Service"]
  node_user_controller["User Controller<br/>[user_controller.py]"]
  node_user_service["User Service<br/>[user_service.py]"]
  node_verification["OTP Verification"]
end

subgraph group_assessment["Mock Tests"]
  node_test_controller["Mock Test Controller"]
  node_test_service["Test Application Service"]
  node_evaluation["Evaluation and Analysis<br/>[evaluation.py]"]
end

subgraph group_rag["Study Assistant"]
  node_rag_controller["RAG Controller<br/>[rag_controller.py]"]
  node_indexer["Document Indexer"]
  node_parser["Document Parsers"]
  node_chunking["Chunking Strategy"]
  node_embeddings["Embeddings"]
  node_vector_store["Vector Store"]
  node_chat_service["RAG Chat Service"]
  node_retrieval["Hybrid Retrieval"]
  node_context_builder["Context Builder<br/>[context_builder.py]"]
  node_llm["LLM Providers"]
end

subgraph group_admin["Administration"]
  node_admin_controller["Admin Controller"]
  node_admin_service["Admin Services"]
  node_storage_maintenance["Storage Maintenance"]
end

subgraph group_persistence["Persistence"]
  node_rag_repository["RAG Repository"]
  node_mongo[("MongoDB")]
end

node_student(("Student"))
node_admin_actor(("Administrator"))
node_ai_provider{{"External AI Provider"}}
node_otp_provider{{"OTP Provider"}}

node_student -->|"uses portal"| node_app
node_admin_actor -->|"uses admin"| node_app
node_app -->|"mounts"| node_auth_ui
node_app -->|"mounts"| node_profile_ui
node_app -->|"mounts"| node_test_ui
node_app -->|"mounts"| node_rag_ui
node_app -->|"mounts"| node_admin_ui
node_auth_ui -->|"sends requests"| node_api_client
node_profile_ui -->|"sends requests"| node_api_client
node_test_ui -->|"sends requests"| node_api_client
node_rag_ui -->|"sends requests"| node_api_client
node_admin_ui -->|"sends requests"| node_api_client
node_api_client -->|"REST requests"| node_auth_controller
node_api_client -->|"REST requests"| node_user_controller
node_api_client -->|"REST requests"| node_test_controller
node_api_client -->|"REST requests"| node_rag_controller
node_api_client -->|"REST requests"| node_admin_controller
node_auth_controller -->|"delegates"| node_auth_service
node_auth_service -->|"sends and verifies OTP"| node_verification
node_verification -.->|"sends OTP"| node_otp_provider
node_auth_service -->|"persists users"| node_mongo
node_user_controller -->|"delegates"| node_user_service
node_user_service -->|"reads and updates profiles"| node_mongo
node_test_controller -->|"delegates"| node_test_service
node_test_service -->|"evaluates submissions"| node_evaluation
node_evaluation -->|"stores performance"| node_mongo
node_rag_controller -->|"indexes uploads"| node_indexer
node_indexer -->|"parses files"| node_parser
node_indexer -->|"splits documents"| node_chunking
node_indexer -->|"embeds chunks"| node_embeddings
node_indexer -->|"saves document"| node_rag_repository
node_indexer -->|"adds vectors"| node_vector_store
node_vector_store -->|"stores vectors"| node_mongo
node_rag_controller -->|"asks and manages chats"| node_chat_service
node_chat_service -->|"retrieves and reranks"| node_retrieval
node_chat_service -->|"builds context"| node_context_builder
node_chat_service -->|"generates answer"| node_llm
node_llm -.->|"calls configured provider"| node_ai_provider
node_chat_service -->|"loads and saves chats"| node_rag_repository
node_chat_service -->|"loads user profile"| node_mongo
node_retrieval -->|"searches chunks"| node_vector_store
node_admin_controller -->|"delegates operations"| node_admin_service
node_admin_controller -->|"indexes admin documents"| node_indexer
node_admin_controller -->|"manages documents"| node_rag_repository
node_admin_controller -->|"cleans uploads"| node_storage_maintenance
node_admin_service -->|"manages users and content"| node_mongo
node_storage_maintenance -->|"preserves RAG records"| node_mongo

click node_app "https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/App.jsx"
click node_auth_ui "https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/AuthPanel.jsx"
click node_profile_ui "https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/ProfilePanel.jsx"
click node_test_ui "https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/MockTestPanel.jsx"
click node_rag_ui "https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/RagPanel.jsx"
click node_admin_ui "https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/AdminPanel.jsx"
click node_api_client "https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/lib/api.js"
click node_auth_controller "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/auth_controller.py"
click node_auth_service "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/auth/authentication_service.py"
click node_user_controller "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/user_controller.py"
click node_user_service "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/users/user_service.py"
click node_verification "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/verification/otp_verification_service.py"
click node_test_controller "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/mock_test_controller.py"
click node_test_service "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/mocktest/mock_test_application_service.py"
click node_evaluation "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/mocktest/evaluation.py"
click node_rag_controller "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/rag_controller.py"
click node_indexer "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/indexing/indexing_pipeline.py"
click node_parser "https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/parsers"
click node_chunking "https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/chunking"
click node_embeddings "https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/embeddings"
click node_vector_store "https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/vectorstores"
click node_chat_service "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/rag_chat_service.py"
click node_retrieval "https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/retrievers"
click node_context_builder "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/context_builder.py"
click node_llm "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/llm_service_factory.py"
click node_admin_controller "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/admin_controller.py"
click node_admin_service "https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/admin"
click node_storage_maintenance "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/admin/storage_maintenance_service.py"
click node_rag_repository "https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/repositories/mongo_rag_repository.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_auth_ui,node_profile_ui,node_test_ui,node_rag_ui,node_admin_ui,node_api_client toneBlue
class node_auth_controller,node_auth_service,node_user_controller,node_user_service,node_verification toneAmber
class node_test_controller,node_test_service,node_evaluation toneMint
class node_rag_controller,node_indexer,node_parser,node_chunking,node_embeddings,node_vector_store,node_chat_service,node_retrieval,node_context_builder,node_llm toneRose
class node_admin_controller,node_admin_service,node_storage_maintenance,node_student,node_admin_actor,node_ai_provider,node_otp_provider toneIndigo
class node_rag_repository,node_mongo toneTeal
```

## Components

### Student and Admin UI

- [Portal App](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth Panel](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/AuthPanel.jsx): `frontend/src/components/AuthPanel.jsx`
- [Profile Panel](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/ProfilePanel.jsx): `frontend/src/components/ProfilePanel.jsx`
- [Mock Test Panel](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/MockTestPanel.jsx): `frontend/src/components/MockTestPanel.jsx`
- [RAG Panel](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/RagPanel.jsx): `frontend/src/components/RagPanel.jsx`
- [Admin Panel](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/components/AdminPanel.jsx): `frontend/src/components/AdminPanel.jsx`
- [API Client](https://github.com/shayantan1012/gatemind-ai/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`

### Identity and Profiles

- [Auth Controller](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/auth_controller.py): `backend/app/controllers/auth_controller.py`
- [Authentication Service](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/auth/authentication_service.py): `backend/app/services/auth/authentication_service.py`
- [User Controller](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/user_controller.py): `backend/app/controllers/user_controller.py`
- [User Service](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/users/user_service.py): `backend/app/services/users/user_service.py`
- [OTP Verification](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/verification/otp_verification_service.py): `backend/app/services/verification/otp_verification_service.py`

### Mock Tests

- [Mock Test Controller](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/mock_test_controller.py): `backend/app/controllers/mock_test_controller.py`
- [Test Application Service](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/mocktest/mock_test_application_service.py): `backend/app/services/mocktest/mock_test_application_service.py`
- [Evaluation and Analysis](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/mocktest/evaluation.py): `backend/app/services/mocktest/evaluation.py`

### Study Assistant

- [RAG Controller](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/rag_controller.py): `backend/app/controllers/rag_controller.py`
- [Document Indexer](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/indexing/indexing_pipeline.py): `backend/app/services/rag/indexing/indexing_pipeline.py`
- [Document Parsers](https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/parsers): `backend/app/services/rag/parsers`
- [Chunking Strategy](https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/chunking): `backend/app/services/rag/chunking`
- [Embeddings](https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/embeddings): `backend/app/services/rag/embeddings`
- [Vector Store](https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/vectorstores): `backend/app/services/rag/vectorstores`
- [RAG Chat Service](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/rag_chat_service.py): `backend/app/services/rag/rag_chat_service.py`
- [Hybrid Retrieval](https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/rag/retrievers): `backend/app/services/rag/retrievers`
- [Context Builder](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/context_builder.py): `backend/app/services/rag/context_builder.py`
- [LLM Providers](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/rag/llm_service_factory.py): `backend/app/services/rag/llm_service_factory.py`

### Administration

- [Admin Controller](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/controllers/admin_controller.py): `backend/app/controllers/admin_controller.py`
- [Admin Services](https://github.com/shayantan1012/gatemind-ai/tree/main/backend/app/services/admin): `backend/app/services/admin`
- [Storage Maintenance](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/services/admin/storage_maintenance_service.py): `backend/app/services/admin/storage_maintenance_service.py`

### Persistence

- [RAG Repository](https://github.com/shayantan1012/gatemind-ai/blob/main/backend/app/repositories/mongo_rag_repository.py): `backend/app/repositories/mongo_rag_repository.py`
- **MongoDB**

### Other components

- **Student**
- **Administrator**
- **External AI Provider**
- **OTP Provider**

## Connections

- Student → Portal App: uses portal
- Administrator → Portal App: uses admin
- Portal App → Auth Panel: mounts
- Portal App → Profile Panel: mounts
- Portal App → Mock Test Panel: mounts
- Portal App → RAG Panel: mounts
- Portal App → Admin Panel: mounts
- Auth Panel → API Client: sends requests
- Profile Panel → API Client: sends requests
- Mock Test Panel → API Client: sends requests
- RAG Panel → API Client: sends requests
- Admin Panel → API Client: sends requests
- API Client → Auth Controller: REST requests
- API Client → User Controller: REST requests
- API Client → Mock Test Controller: REST requests
- API Client → RAG Controller: REST requests
- API Client → Admin Controller: REST requests
- Auth Controller → Authentication Service: delegates
- Authentication Service → OTP Verification: sends and verifies OTP
- OTP Verification → OTP Provider: sends OTP
- Authentication Service → MongoDB: persists users
- User Controller → User Service: delegates
- User Service → MongoDB: reads and updates profiles
- Mock Test Controller → Test Application Service: delegates
- Test Application Service → Evaluation and Analysis: evaluates submissions
- Evaluation and Analysis → MongoDB: stores performance
- RAG Controller → Document Indexer: indexes uploads
- Document Indexer → Document Parsers: parses files
- Document Indexer → Chunking Strategy: splits documents
- Document Indexer → Embeddings: embeds chunks
- Document Indexer → RAG Repository: saves document
- Document Indexer → Vector Store: adds vectors
- Vector Store → MongoDB: stores vectors
- RAG Controller → RAG Chat Service: asks and manages chats
- RAG Chat Service → Hybrid Retrieval: retrieves and reranks
- RAG Chat Service → Context Builder: builds context
- RAG Chat Service → LLM Providers: generates answer
- LLM Providers → External AI Provider: calls configured provider
- RAG Chat Service → RAG Repository: loads and saves chats
- RAG Chat Service → MongoDB: loads user profile
- Hybrid Retrieval → Vector Store: searches chunks
- Admin Controller → Admin Services: delegates operations
- Admin Controller → Document Indexer: indexes admin documents
- Admin Controller → RAG Repository: manages documents
- Admin Controller → Storage Maintenance: cleans uploads
- Admin Services → MongoDB: manages users and content
- Storage Maintenance → MongoDB: preserves RAG records
