# shilpiskzz/nexus architecture

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

- Interactive diagram: https://gitdiagram.com/shilpiskzz/nexus
- Repository: https://github.com/shilpiskzz/nexus

## Overview

Nexus is a codebase assistant whose main workflow ingests a GitHub repository or ZIP, indexes its code, and serves repository-grounded chat, search, review, error analysis, and documentation. The frontend calls a FastAPI API; backend services coordinate repository processing, retrieval, and AI providers, while PostgreSQL stores application metadata and Qdrant stores vectors. The README documents the shared RAG pipeline and product capabilities; service-level links for unsampled features are included only where that documentation supports them.

Main entry points: [`backend/app/api/v1/endpoints`](https://github.com/shilpiskzz/nexus/tree/main/backend/app/api/v1/endpoints) (API endpoints), [`backend/app/services/retriever_service.py`](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/retriever_service.py) (Context retrieval), [`backend/app/services/llm_service.py`](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/llm_service.py) (LLM selection), [`backend/app/services/review_service.py`](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/review_service.py) (Code review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Next.js experience"]
  node_api_client["REST client"]
end

subgraph group_api["API and workflows"]
  node_fastapi["FastAPI application<br/>[main.py]"]
  node_routes["API endpoints"]
  node_auth["Authentication<br/>[auth_service.py]"]
  node_repository["Repository management"]
  node_chat["Codebase chat<br/>[chat_service.py]"]
  node_search["Code search<br/>[search_service.py]"]
  node_review["Code review<br/>[review_service.py]"]
  node_errors["Error analysis"]
  node_docs["Documentation generation"]
end

subgraph group_ingest["Repository indexing"]
  node_processor["Clone, extract, filter"]
  node_chunker["Semantic chunking<br/>[chunker.py]"]
  node_embedding["Embedding workflow"]
end

subgraph group_rag["AI and retrieval"]
  node_retriever["Context retrieval"]
  node_prompts["Prompt assembly<br/>[prompt_service.py]"]
  node_llm_service["LLM selection<br/>[llm_service.py]"]
  node_llm["OpenAI or Claude"]
  node_embeddings["OpenAI or BGE"]
  node_qdrant_client["Vector store adapter<br/>[qdrant_client.py]"]
end

subgraph group_state["Persistence"]
  node_postgres[("PostgreSQL metadata")]
  node_models["Domain records"]
  node_qdrant[("Qdrant vectors")]
end

node_developer(("Developer"))

node_developer -->|"uses"| node_web
node_web -->|"invokes"| node_api_client
node_api_client -->|"REST / SSE"| node_fastapi
node_fastapi -->|"routes to"| node_routes
node_routes -->|"delegates to"| node_auth
node_routes -.->|"delegates to"| node_repository
node_routes -->|"delegates to"| node_chat
node_routes -.->|"delegates to"| node_search
node_routes -->|"delegates to"| node_review
node_routes -.->|"delegates to"| node_errors
node_routes -.->|"delegates to"| node_docs
node_repository -->|"processes source"| node_processor
node_processor -->|"chunks files"| node_chunker
node_chunker -->|"provides chunks"| node_embedding
node_embedding -->|"embeds chunks"| node_embeddings
node_embedding -->|"upserts vectors"| node_qdrant_client
node_qdrant_client -->|"writes vectors"| node_qdrant
node_chat -->|"retrieves context"| node_retriever
node_search -->|"retrieves context"| node_retriever
node_retriever -->|"embeds query"| node_embeddings
node_retriever -->|"searches vectors"| node_qdrant_client
node_chat -->|"builds prompts"| node_prompts
node_search -->|"builds prompts"| node_prompts
node_review -->|"selects provider"| node_llm_service
node_review -->|"builds review prompt"| node_prompts
node_errors -.->|"optional repo context"| node_retriever
node_errors -.->|"selects provider"| node_llm_service
node_docs -.->|"retrieves context"| node_retriever
node_docs -.->|"selects provider"| node_llm_service
node_prompts -->|"supplies prompts"| node_llm_service
node_llm_service -->|"selects provider"| node_llm
node_llm -.->|"returns response"| node_chat
node_models -->|"persists metadata"| node_postgres
node_repository -.->|"records repository"| node_models
node_embedding -->|"stores chunk metadata"| node_models
node_review -->|"stores review history"| node_models

click node_web "https://github.com/shilpiskzz/nexus/tree/main/frontend/src/app"
click node_api_client "https://github.com/shilpiskzz/nexus/tree/main/frontend/src/lib/api"
click node_fastapi "https://github.com/shilpiskzz/nexus/blob/main/backend/app/main.py"
click node_routes "https://github.com/shilpiskzz/nexus/tree/main/backend/app/api/v1/endpoints"
click node_auth "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/auth_service.py"
click node_repository "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/repository_service.py"
click node_chat "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/chat_service.py"
click node_search "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/search_service.py"
click node_review "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/review_service.py"
click node_errors "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/error_analysis_service.py"
click node_docs "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/documentation_service.py"
click node_processor "https://github.com/shilpiskzz/nexus/tree/main/backend/app/repository_processor"
click node_chunker "https://github.com/shilpiskzz/nexus/blob/main/backend/app/repository_processor/chunker.py"
click node_embedding "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/embedding_service.py"
click node_retriever "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/retriever_service.py"
click node_prompts "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/prompt_service.py"
click node_llm_service "https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/llm_service.py"
click node_llm "https://github.com/shilpiskzz/nexus/tree/main/backend/app/ai/providers"
click node_embeddings "https://github.com/shilpiskzz/nexus/tree/main/backend/app/ai/embeddings"
click node_qdrant_client "https://github.com/shilpiskzz/nexus/blob/main/backend/app/ai/vector_store/qdrant_client.py"
click node_models "https://github.com/shilpiskzz/nexus/tree/main/backend/app/models"

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_web,node_api_client toneBlue
class node_fastapi,node_routes,node_auth,node_repository,node_chat,node_search,node_review,node_errors,node_docs toneAmber
class node_processor,node_chunker,node_embedding toneMint
class node_retriever,node_prompts,node_llm_service,node_llm,node_embeddings,node_qdrant_client toneRose
class node_postgres,node_models,node_qdrant,node_developer toneIndigo
```

## Components

### Web client

- [Next.js experience](https://github.com/shilpiskzz/nexus/tree/main/frontend/src/app): `frontend/src/app`
- [REST client](https://github.com/shilpiskzz/nexus/tree/main/frontend/src/lib/api): `frontend/src/lib/api`

### API and workflows

- [FastAPI application](https://github.com/shilpiskzz/nexus/blob/main/backend/app/main.py): `backend/app/main.py`
- [API endpoints](https://github.com/shilpiskzz/nexus/tree/main/backend/app/api/v1/endpoints): `backend/app/api/v1/endpoints`
- [Authentication](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Repository management](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/repository_service.py): `backend/app/services/repository_service.py`
- [Codebase chat](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/chat_service.py): `backend/app/services/chat_service.py`
- [Code search](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/search_service.py): `backend/app/services/search_service.py`
- [Code review](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/review_service.py): `backend/app/services/review_service.py`
- [Error analysis](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/error_analysis_service.py): `backend/app/services/error_analysis_service.py`
- [Documentation generation](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/documentation_service.py): `backend/app/services/documentation_service.py`

### Repository indexing

- [Clone, extract, filter](https://github.com/shilpiskzz/nexus/tree/main/backend/app/repository_processor): `backend/app/repository_processor`
- [Semantic chunking](https://github.com/shilpiskzz/nexus/blob/main/backend/app/repository_processor/chunker.py): `backend/app/repository_processor/chunker.py`
- [Embedding workflow](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/embedding_service.py): `backend/app/services/embedding_service.py`

### AI and retrieval

- [Context retrieval](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/retriever_service.py): `backend/app/services/retriever_service.py`
- [Prompt assembly](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/prompt_service.py): `backend/app/services/prompt_service.py`
- [LLM selection](https://github.com/shilpiskzz/nexus/blob/main/backend/app/services/llm_service.py): `backend/app/services/llm_service.py`
- [OpenAI or Claude](https://github.com/shilpiskzz/nexus/tree/main/backend/app/ai/providers): `backend/app/ai/providers`
- [OpenAI or BGE](https://github.com/shilpiskzz/nexus/tree/main/backend/app/ai/embeddings): `backend/app/ai/embeddings`
- [Vector store adapter](https://github.com/shilpiskzz/nexus/blob/main/backend/app/ai/vector_store/qdrant_client.py): `backend/app/ai/vector_store/qdrant_client.py`

### Persistence

- **PostgreSQL metadata**
- [Domain records](https://github.com/shilpiskzz/nexus/tree/main/backend/app/models): `backend/app/models`
- **Qdrant vectors**

### Other components

- **Developer**

## Connections

- Developer → Next.js experience: uses (evidence: `README.md`)
- Next.js experience → REST client: invokes (evidence: `README.md`)
- REST client → FastAPI application: REST / SSE (evidence: `README.md`)
- FastAPI application → API endpoints: routes to (evidence: `backend/app/main.py`)
- API endpoints → Authentication: delegates to (evidence: `backend/app/api/v1/endpoints/auth.py`)
- API endpoints → Repository management: delegates to (evidence: `backend/app/api/v1/endpoints/chat.py`)
- API endpoints → Codebase chat: delegates to (evidence: `backend/app/api/v1/endpoints/chat.py`)
- API endpoints → Code search: delegates to
- API endpoints → Code review: delegates to (evidence: `backend/app/api/v1/endpoints/review.py`)
- API endpoints → Error analysis: delegates to
- API endpoints → Documentation generation: delegates to
- Repository management → Clone, extract, filter: processes source (evidence: `README.md`)
- Clone, extract, filter → Semantic chunking: chunks files (evidence: `README.md`)
- Semantic chunking → Embedding workflow: provides chunks (evidence: `backend/app/services/embedding_service.py`)
- Embedding workflow → OpenAI or BGE: embeds chunks (evidence: `backend/app/services/embedding_service.py`)
- Embedding workflow → Vector store adapter: upserts vectors (evidence: `backend/app/services/embedding_service.py`)
- Vector store adapter → Qdrant vectors: writes vectors (evidence: `backend/app/ai/vector_store/qdrant_client.py`)
- Codebase chat → Context retrieval: retrieves context (evidence: `README.md`)
- Code search → Context retrieval: retrieves context (evidence: `README.md`)
- Context retrieval → OpenAI or BGE: embeds query (evidence: `README.md`)
- Context retrieval → Vector store adapter: searches vectors (evidence: `backend/app/services/retriever_service.py`)
- Codebase chat → Prompt assembly: builds prompts (evidence: `README.md`)
- Code search → Prompt assembly: builds prompts (evidence: `README.md`)
- Code review → LLM selection: selects provider (evidence: `backend/app/services/review_service.py`)
- Code review → Prompt assembly: builds review prompt (evidence: `backend/app/services/review_service.py`)
- Error analysis → Context retrieval: optional repo context (evidence: `README.md`)
- Error analysis → LLM selection: selects provider (evidence: `README.md`)
- Documentation generation → Context retrieval: retrieves context (evidence: `README.md`)
- Documentation generation → LLM selection: selects provider (evidence: `README.md`)
- Prompt assembly → LLM selection: supplies prompts (evidence: `README.md`)
- LLM selection → OpenAI or Claude: selects provider (evidence: `backend/app/services/llm_service.py`)
- OpenAI or Claude → Codebase chat: returns response
- Domain records → PostgreSQL metadata: persists metadata (evidence: `README.md`)
- Repository management → Domain records: records repository
- Embedding workflow → Domain records: stores chunk metadata (evidence: `backend/app/services/embedding_service.py`)
- Code review → Domain records: stores review history (evidence: `backend/app/services/review_service.py`)
