# shivanshpandey2005/nexusrag architecture

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

- Interactive diagram: https://gitdiagram.com/shivanshpandey2005/nexusrag
- Repository: https://github.com/shivanshpandey2005/nexusrag

## Overview

NexusRAG combines a Next.js enterprise knowledge-management console with a FastAPI RAG backend. The main workflow is document upload, parsing and chunking, embedding and indexing, followed by multi-agent retrieval and query answering; the UI also presents search, graph, analytics, observability, workspace and compliance capabilities. The frontend’s mock data and authentication are visible in sampled files. Some backend internals and UI-to-backend wiring were not sampled, so the graph avoids asserting an unverified connection between them.

Main entry points: [`backend/main.py`](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/main.py) (FastAPI endpoints), [`src/lib/db-mock.ts`](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/lib/db-mock.ts) (Mock enterprise data), [`src/context/auth-context.tsx`](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/context/auth-context.tsx) (Auth context), [`src/components/app-shell.tsx`](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/components/app-shell.tsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Enterprise Console"]
  node_shell["App shell<br/>[app-shell.tsx]"]
  node_command["Command menu<br/>[command-menu.tsx]"]
  node_dashboard["Operations dashboard<br/>[page.tsx]"]
  node_search_ui["Enterprise search<br/>[page.tsx]"]
  node_documents_ui["Document center<br/>[page.tsx]"]
  node_graph_ui["Knowledge graph explorer<br/>[page.tsx]"]
  node_kb_ui["Knowledge bases<br/>[page.tsx]"]
  node_analytics_ui["Analytics<br/>[page.tsx]"]
  node_observability_ui["Observability<br/>[page.tsx]"]
  node_workspaces_ui["Workspaces and access<br/>[page.tsx]"]
  node_workflows_ui["Workflows<br/>[page.tsx]"]
  node_settings_ui["Compliance settings<br/>[page.tsx]"]
  node_mock_data[("Mock enterprise data<br/>[db-mock.ts]")]
end

subgraph group_auth["Authentication"]
  node_auth_context["Auth context<br/>[auth-context.tsx]"]
  node_login_ui["Login and signup<br/>[page.tsx]"]
  node_login_api["Login endpoint<br/>[route.ts]"]
  node_signup_api["Signup endpoint<br/>[route.ts]"]
  node_profile_api["Session endpoint<br/>[route.ts]"]
  node_jwt["Mock JWT<br/>[jwt-mock.ts]"]
end

subgraph group_api["Backend API"]
  node_backend_api["FastAPI endpoints<br/>[main.py]"]
  node_limiter["Rate limiter<br/>[rate_limiter.py]"]
  node_config["Backend configuration<br/>[config.py]"]
end

subgraph group_ingestion["Ingestion and Indexing"]
  node_parsers["Document parsers<br/>[parsers.py]"]
  node_chunker["Semantic chunker<br/>[chunker.py]"]
  node_embeddings["Dense and sparse embeddings<br/>[embeddings.py]"]
  node_vector_store[("Vector store<br/>[vector_store.py]")]
end

subgraph group_intelligence["Retrieval and Memory"]
  node_agent["Multi-agent orchestrator<br/>[multi_agent.py]"]
  node_retrieval["Hybrid retrieval and reranking<br/>[retrieval.py]"]
  node_memory[("Conversation and cache memory<br/>[memory.py]")]
end

node_user(("Enterprise user"))

node_user -->|"uses console"| node_shell
node_shell -->|"renders"| node_command
node_shell -->|"checks session"| node_auth_context
node_user -->|"searches knowledge"| node_search_ui
node_user -->|"manages documents"| node_documents_ui
node_user -->|"explores graph"| node_graph_ui
node_user -->|"monitors operations"| node_dashboard
node_user -->|"views analytics"| node_analytics_ui
node_user -->|"inspects traces"| node_observability_ui
node_user -->|"manages access"| node_workspaces_ui
node_user -->|"manages workflows"| node_workflows_ui
node_user -->|"sets guardrails"| node_settings_ui
node_dashboard -->|"reads data"| node_mock_data
node_search_ui -->|"reads data"| node_mock_data
node_documents_ui -->|"reads data"| node_mock_data
node_graph_ui -->|"reads data"| node_mock_data
node_kb_ui -->|"reads data"| node_mock_data
node_analytics_ui -->|"reads data"| node_mock_data
node_observability_ui -->|"reads data"| node_mock_data
node_workspaces_ui -->|"reads data"| node_mock_data
node_login_ui -->|"uses auth"| node_auth_context
node_auth_context -->|"posts credentials"| node_login_api
node_auth_context -->|"posts signup"| node_signup_api
node_auth_context -->|"checks session"| node_profile_api
node_login_api -->|"signs token"| node_jwt
node_signup_api -->|"signs token"| node_jwt
node_profile_api -->|"verifies token"| node_jwt
node_user -->|"uploads or queries"| node_backend_api
node_backend_api -->|"rate limits routes"| node_limiter
node_backend_api -->|"parses uploads"| node_parsers
node_backend_api -->|"chunks content"| node_chunker
node_backend_api -->|"indexes vectors"| node_vector_store
node_backend_api -->|"executes query"| node_agent
node_backend_api -->|"checks service health"| node_memory
node_agent -->|"retrieves candidates"| node_retrieval
node_agent -->|"uses conversation memory"| node_memory
node_retrieval -->|"searches vectors"| node_vector_store
node_retrieval -->|"embeds queries"| node_embeddings
node_chunker -->|"reads defaults"| node_config
node_embeddings -->|"reads model settings"| node_config
node_vector_store -->|"reads store settings"| node_config

click node_shell "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/components/app-shell.tsx"
click node_command "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/components/command-menu.tsx"
click node_dashboard "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/dashboard/page.tsx"
click node_search_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/search/page.tsx"
click node_documents_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/documents/page.tsx"
click node_graph_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/graph/page.tsx"
click node_kb_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/knowledge-bases/page.tsx"
click node_analytics_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/analytics/page.tsx"
click node_observability_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/observability/page.tsx"
click node_workspaces_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/workspaces/page.tsx"
click node_workflows_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/workflows/page.tsx"
click node_settings_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/settings/page.tsx"
click node_mock_data "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/lib/db-mock.ts"
click node_auth_context "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/context/auth-context.tsx"
click node_login_ui "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/login/page.tsx"
click node_login_api "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/api/auth/login/route.ts"
click node_signup_api "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/api/auth/signup/route.ts"
click node_profile_api "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/api/auth/me/route.ts"
click node_jwt "https://github.com/shivanshpandey2005/nexusrag/blob/main/src/lib/jwt-mock.ts"
click node_backend_api "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/main.py"
click node_limiter "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/rate_limiter.py"
click node_parsers "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/parsers.py"
click node_chunker "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/chunker.py"
click node_embeddings "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/embeddings.py"
click node_vector_store "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/vector_store.py"
click node_agent "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/multi_agent.py"
click node_retrieval "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/retrieval.py"
click node_memory "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/memory.py"
click node_config "https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/config.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_shell,node_command,node_dashboard,node_search_ui,node_documents_ui,node_graph_ui,node_kb_ui,node_analytics_ui,node_observability_ui,node_workspaces_ui,node_workflows_ui,node_settings_ui,node_mock_data,node_user toneBlue
class node_auth_context,node_login_ui,node_login_api,node_signup_api,node_profile_api,node_jwt toneAmber
class node_backend_api,node_limiter,node_config toneMint
class node_parsers,node_chunker,node_embeddings,node_vector_store toneRose
class node_agent,node_retrieval,node_memory toneIndigo
```

## Components

### Enterprise Console

- [App shell](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/components/app-shell.tsx): `src/components/app-shell.tsx`
- [Command menu](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/components/command-menu.tsx): `src/components/command-menu.tsx`
- [Operations dashboard](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Enterprise search](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/search/page.tsx): `src/app/search/page.tsx`
- [Document center](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/documents/page.tsx): `src/app/documents/page.tsx`
- [Knowledge graph explorer](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/graph/page.tsx): `src/app/graph/page.tsx`
- [Knowledge bases](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/knowledge-bases/page.tsx): `src/app/knowledge-bases/page.tsx`
- [Analytics](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/analytics/page.tsx): `src/app/analytics/page.tsx`
- [Observability](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/observability/page.tsx): `src/app/observability/page.tsx`
- [Workspaces and access](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/workspaces/page.tsx): `src/app/workspaces/page.tsx`
- [Workflows](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/workflows/page.tsx): `src/app/workflows/page.tsx`
- [Compliance settings](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/settings/page.tsx): `src/app/settings/page.tsx`
- [Mock enterprise data](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/lib/db-mock.ts): `src/lib/db-mock.ts`

### Authentication

- [Auth context](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/context/auth-context.tsx): `src/context/auth-context.tsx`
- [Login and signup](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Login endpoint](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/api/auth/login/route.ts): `src/app/api/auth/login/route.ts`
- [Signup endpoint](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/api/auth/signup/route.ts): `src/app/api/auth/signup/route.ts`
- [Session endpoint](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/app/api/auth/me/route.ts): `src/app/api/auth/me/route.ts`
- [Mock JWT](https://github.com/shivanshpandey2005/nexusrag/blob/main/src/lib/jwt-mock.ts): `src/lib/jwt-mock.ts`

### Backend API

- [FastAPI endpoints](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/main.py): `backend/main.py`
- [Rate limiter](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/rate_limiter.py): `backend/rate_limiter.py`
- [Backend configuration](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/config.py): `backend/config.py`

### Ingestion and Indexing

- [Document parsers](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/parsers.py): `backend/parsers.py`
- [Semantic chunker](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/chunker.py): `backend/chunker.py`
- [Dense and sparse embeddings](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/embeddings.py): `backend/embeddings.py`
- [Vector store](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/vector_store.py): `backend/vector_store.py`

### Retrieval and Memory

- [Multi-agent orchestrator](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/multi_agent.py): `backend/multi_agent.py`
- [Hybrid retrieval and reranking](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/retrieval.py): `backend/retrieval.py`
- [Conversation and cache memory](https://github.com/shivanshpandey2005/nexusrag/blob/main/backend/memory.py): `backend/memory.py`

### Other components

- **Enterprise user**

## Connections

- Enterprise user → App shell: uses console (evidence: `README.md`)
- App shell → Command menu: renders (evidence: `src/components/app-shell.tsx`)
- App shell → Auth context: checks session (evidence: `src/components/app-shell.tsx`)
- Enterprise user → Enterprise search: searches knowledge (evidence: `README.md`)
- Enterprise user → Document center: manages documents (evidence: `README.md`)
- Enterprise user → Knowledge graph explorer: explores graph (evidence: `README.md`)
- Enterprise user → Operations dashboard: monitors operations (evidence: `README.md`)
- Enterprise user → Analytics: views analytics (evidence: `README.md`)
- Enterprise user → Observability: inspects traces (evidence: `README.md`)
- Enterprise user → Workspaces and access: manages access (evidence: `README.md`)
- Enterprise user → Workflows: manages workflows (evidence: `README.md`)
- Enterprise user → Compliance settings: sets guardrails (evidence: `README.md`)
- Operations dashboard → Mock enterprise data: reads data (evidence: `src/app/dashboard/page.tsx`)
- Enterprise search → Mock enterprise data: reads data (evidence: `src/app/search/page.tsx`)
- Document center → Mock enterprise data: reads data (evidence: `src/app/documents/page.tsx`)
- Knowledge graph explorer → Mock enterprise data: reads data (evidence: `src/app/graph/page.tsx`)
- Knowledge bases → Mock enterprise data: reads data (evidence: `src/app/knowledge-bases/page.tsx`)
- Analytics → Mock enterprise data: reads data (evidence: `src/app/analytics/page.tsx`)
- Observability → Mock enterprise data: reads data (evidence: `src/app/observability/page.tsx`)
- Workspaces and access → Mock enterprise data: reads data (evidence: `src/app/workspaces/page.tsx`)
- Login and signup → Auth context: uses auth (evidence: `src/app/login/page.tsx`)
- Auth context → Login endpoint: posts credentials (evidence: `src/context/auth-context.tsx`)
- Auth context → Signup endpoint: posts signup (evidence: `src/context/auth-context.tsx`)
- Auth context → Session endpoint: checks session (evidence: `src/context/auth-context.tsx`)
- Login endpoint → Mock JWT: signs token (evidence: `src/app/api/auth/login/route.ts`)
- Signup endpoint → Mock JWT: signs token (evidence: `src/app/api/auth/signup/route.ts`)
- Session endpoint → Mock JWT: verifies token (evidence: `src/app/api/auth/me/route.ts`)
- Enterprise user → FastAPI endpoints: uploads or queries (evidence: `README.md`)
- FastAPI endpoints → Rate limiter: rate limits routes (evidence: `backend/main.py`)
- FastAPI endpoints → Document parsers: parses uploads (evidence: `backend/main.py`)
- FastAPI endpoints → Semantic chunker: chunks content (evidence: `backend/main.py`)
- FastAPI endpoints → Vector store: indexes vectors (evidence: `backend/main.py`)
- FastAPI endpoints → Multi-agent orchestrator: executes query (evidence: `backend/main.py`)
- FastAPI endpoints → Conversation and cache memory: checks service health (evidence: `backend/main.py`)
- Multi-agent orchestrator → Hybrid retrieval and reranking: retrieves candidates (evidence: `backend/multi_agent.py`)
- Multi-agent orchestrator → Conversation and cache memory: uses conversation memory (evidence: `backend/multi_agent.py`)
- Hybrid retrieval and reranking → Vector store: searches vectors (evidence: `backend/retrieval.py`)
- Hybrid retrieval and reranking → Dense and sparse embeddings: embeds queries (evidence: `backend/retrieval.py`)
- Semantic chunker → Backend configuration: reads defaults (evidence: `backend/chunker.py`)
- Dense and sparse embeddings → Backend configuration: reads model settings (evidence: `backend/embeddings.py`)
- Vector store → Backend configuration: reads store settings (evidence: `backend/vector_store.py`)
