# anikaitar70/aidebug architecture

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

- Interactive diagram: https://gitdiagram.com/anikaitar70/aidebug
- Repository: https://github.com/anikaitar70/aidebug

## Overview

AI Debug RAG API accepts repository uploads, safely extracts and indexes source code, then answers code questions using session-scoped retrieval and Gemini. The graph follows the documented upload-to-answer workflow and includes indexing audits, project overviews, retrieval-only queries, and shared security/configuration. Edges reflect README statements or relationships named in the SOURCE INDEX; unsampled service internals are not inferred.

Main entry points: [`app/api/upload.py`](https://github.com/anikaitar70/aidebug/blob/main/app/api/upload.py) (Upload endpoints), [`app/api/query.py`](https://github.com/anikaitar70/aidebug/blob/main/app/api/query.py) (Query and stats endpoints), [`main.py`](https://github.com/anikaitar70/aidebug/blob/main/main.py) (FastAPI application), [`app/services/retrieval_service.py`](https://github.com/anikaitar70/aidebug/blob/main/app/services/retrieval_service.py) (Vector retrieval and ranking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and UI"]
  node_web_ui["Static web UI<br/>[index.html]"]
  node_app_server["FastAPI application<br/>[main.py]"]
  node_upload_api["Upload endpoints<br/>[upload.py]"]
  node_query_api["Query and stats endpoints<br/>[query.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
end

subgraph group_index["Repository indexing"]
  node_zip["Safe ZIP extraction<br/>[zip_handler.py]"]
  node_file_service["File handling<br/>[file_service.py]"]
  node_path_filters["Path filtering<br/>[path_filters.py]"]
  node_parser["Code parsing and chunking<br/>[code_parser.py]"]
  node_overview["Project overview"]
end

subgraph group_rag["Retrieval and answers"]
  node_embedding["Embedding service"]
  node_retrieval["Vector retrieval and ranking"]
  node_classifier["Query intent classification"]
  node_llm["Gemini response generation<br/>[llm_service.py]"]
end

subgraph group_state["Session state"]
  node_session_store[("Session store<br/>[session_store.py]")]
end

subgraph group_platform["Security and configuration"]
  node_security["Authentication and rate limiting<br/>[security.py]"]
  node_config["Application settings<br/>[config.py]"]
end

node_client(("Client"))
node_gemini{{"Google Gemini"}}

node_client -.->|"uses"| node_web_ui
node_client -->|"calls API"| node_app_server
node_web_ui -.->|"calls API"| node_app_server
node_app_server -->|"registers routes"| node_upload_api
node_app_server -->|"registers routes"| node_query_api
node_upload_api -->|"uses models"| node_schemas
node_query_api -->|"uses models"| node_schemas
node_upload_api -->|"extracts archives"| node_zip
node_upload_api -->|"handles files"| node_file_service
node_upload_api -->|"parses source"| node_parser
node_upload_api -->|"embeds chunks"| node_embedding
node_upload_api -->|"stores chunks"| node_retrieval
node_upload_api -->|"updates session"| node_session_store
node_upload_api -->|"generates overview"| node_overview
node_zip -->|"filters paths"| node_path_filters
node_parser -->|"filters paths"| node_path_filters
node_query_api -->|"embeds query"| node_embedding
node_query_api -->|"retrieves context"| node_retrieval
node_query_api -->|"classifies query"| node_classifier
node_query_api -->|"generates answer"| node_llm
node_query_api -->|"resolves session"| node_session_store
node_retrieval -->|"uses intent"| node_classifier
node_retrieval -->|"reads session"| node_session_store
node_llm -->|"generates response"| node_gemini
node_app_server -->|"configures security"| node_security
node_security -->|"loads settings"| node_config
node_upload_api -->|"uses rate limits"| node_security
node_query_api -->|"uses rate limits"| node_security

click node_web_ui "https://github.com/anikaitar70/aidebug/blob/main/index.html"
click node_app_server "https://github.com/anikaitar70/aidebug/blob/main/main.py"
click node_upload_api "https://github.com/anikaitar70/aidebug/blob/main/app/api/upload.py"
click node_query_api "https://github.com/anikaitar70/aidebug/blob/main/app/api/query.py"
click node_schemas "https://github.com/anikaitar70/aidebug/blob/main/app/models/schemas.py"
click node_zip "https://github.com/anikaitar70/aidebug/blob/main/app/utils/zip_handler.py"
click node_file_service "https://github.com/anikaitar70/aidebug/blob/main/app/services/file_service.py"
click node_path_filters "https://github.com/anikaitar70/aidebug/blob/main/app/utils/path_filters.py"
click node_parser "https://github.com/anikaitar70/aidebug/blob/main/app/services/code_parser.py"
click node_overview "https://github.com/anikaitar70/aidebug/blob/main/app/services/project_overview_service.py"
click node_embedding "https://github.com/anikaitar70/aidebug/blob/main/app/services/embedding_service.py"
click node_retrieval "https://github.com/anikaitar70/aidebug/blob/main/app/services/retrieval_service.py"
click node_classifier "https://github.com/anikaitar70/aidebug/blob/main/app/services/query_classifier.py"
click node_llm "https://github.com/anikaitar70/aidebug/blob/main/app/services/llm_service.py"
click node_session_store "https://github.com/anikaitar70/aidebug/blob/main/app/services/session_store.py"
click node_security "https://github.com/anikaitar70/aidebug/blob/main/app/security.py"
click node_config "https://github.com/anikaitar70/aidebug/blob/main/app/utils/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_web_ui,node_app_server,node_upload_api,node_query_api,node_schemas,node_client toneBlue
class node_zip,node_file_service,node_path_filters,node_parser,node_overview toneAmber
class node_embedding,node_retrieval,node_classifier,node_llm toneMint
class node_session_store toneRose
class node_security,node_config,node_gemini toneIndigo
```

## Components

### API and UI

- [Static web UI](https://github.com/anikaitar70/aidebug/blob/main/index.html): `index.html`
- [FastAPI application](https://github.com/anikaitar70/aidebug/blob/main/main.py): `main.py`
- [Upload endpoints](https://github.com/anikaitar70/aidebug/blob/main/app/api/upload.py): `app/api/upload.py`
- [Query and stats endpoints](https://github.com/anikaitar70/aidebug/blob/main/app/api/query.py): `app/api/query.py`
- [Request and response schemas](https://github.com/anikaitar70/aidebug/blob/main/app/models/schemas.py): `app/models/schemas.py`

### Repository indexing

- [Safe ZIP extraction](https://github.com/anikaitar70/aidebug/blob/main/app/utils/zip_handler.py): `app/utils/zip_handler.py`
- [File handling](https://github.com/anikaitar70/aidebug/blob/main/app/services/file_service.py): `app/services/file_service.py`
- [Path filtering](https://github.com/anikaitar70/aidebug/blob/main/app/utils/path_filters.py): `app/utils/path_filters.py`
- [Code parsing and chunking](https://github.com/anikaitar70/aidebug/blob/main/app/services/code_parser.py): `app/services/code_parser.py`
- [Project overview](https://github.com/anikaitar70/aidebug/blob/main/app/services/project_overview_service.py): `app/services/project_overview_service.py`

### Retrieval and answers

- [Embedding service](https://github.com/anikaitar70/aidebug/blob/main/app/services/embedding_service.py): `app/services/embedding_service.py`
- [Vector retrieval and ranking](https://github.com/anikaitar70/aidebug/blob/main/app/services/retrieval_service.py): `app/services/retrieval_service.py`
- [Query intent classification](https://github.com/anikaitar70/aidebug/blob/main/app/services/query_classifier.py): `app/services/query_classifier.py`
- [Gemini response generation](https://github.com/anikaitar70/aidebug/blob/main/app/services/llm_service.py): `app/services/llm_service.py`

### Session state

- [Session store](https://github.com/anikaitar70/aidebug/blob/main/app/services/session_store.py): `app/services/session_store.py`

### Security and configuration

- [Authentication and rate limiting](https://github.com/anikaitar70/aidebug/blob/main/app/security.py): `app/security.py`
- [Application settings](https://github.com/anikaitar70/aidebug/blob/main/app/utils/config.py): `app/utils/config.py`

### Other components

- **Client**
- **Google Gemini**

## Connections

- Client → Static web UI: uses (evidence: `README.md`)
- Client → FastAPI application: calls API (evidence: `README.md`)
- Static web UI → FastAPI application: calls API (evidence: `README.md`)
- FastAPI application → Upload endpoints: registers routes (evidence: `main.py`)
- FastAPI application → Query and stats endpoints: registers routes (evidence: `main.py`)
- Upload endpoints → Request and response schemas: uses models (evidence: `app/api/upload.py`)
- Query and stats endpoints → Request and response schemas: uses models (evidence: `app/api/query.py`)
- Upload endpoints → Safe ZIP extraction: extracts archives (evidence: `app/api/upload.py`)
- Upload endpoints → File handling: handles files (evidence: `app/api/upload.py`)
- Upload endpoints → Code parsing and chunking: parses source (evidence: `app/api/upload.py`)
- Upload endpoints → Embedding service: embeds chunks (evidence: `app/api/upload.py`)
- Upload endpoints → Vector retrieval and ranking: stores chunks (evidence: `app/api/upload.py`)
- Upload endpoints → Session store: updates session (evidence: `app/api/upload.py`)
- Upload endpoints → Project overview: generates overview (evidence: `app/api/upload.py`)
- Safe ZIP extraction → Path filtering: filters paths (evidence: `app/utils/zip_handler.py`)
- Code parsing and chunking → Path filtering: filters paths (evidence: `app/services/code_parser.py`)
- Query and stats endpoints → Embedding service: embeds query (evidence: `app/api/query.py`)
- Query and stats endpoints → Vector retrieval and ranking: retrieves context (evidence: `app/api/query.py`)
- Query and stats endpoints → Query intent classification: classifies query (evidence: `app/api/query.py`)
- Query and stats endpoints → Gemini response generation: generates answer (evidence: `app/api/query.py`)
- Query and stats endpoints → Session store: resolves session (evidence: `app/api/query.py`)
- Vector retrieval and ranking → Query intent classification: uses intent (evidence: `app/services/retrieval_service.py`)
- Vector retrieval and ranking → Session store: reads session (evidence: `app/services/retrieval_service.py`)
- Gemini response generation → Google Gemini: generates response (evidence: `app/services/llm_service.py`)
- FastAPI application → Authentication and rate limiting: configures security (evidence: `main.py`)
- Authentication and rate limiting → Application settings: loads settings (evidence: `app/security.py`)
- Upload endpoints → Authentication and rate limiting: uses rate limits (evidence: `app/api/upload.py`)
- Query and stats endpoints → Authentication and rate limiting: uses rate limits (evidence: `app/api/query.py`)
