# gurram-rohith/graphrag-backend architecture

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

- Interactive diagram: https://gitdiagram.com/gurram-rohith/graphrag-backend
- Repository: https://github.com/gurram-rohith/graphrag-backend

## Overview

This backend provides GraphRAG over source repositories: it accepts a repository URL, clones and filters files, parses and summarizes supported code, stores graph and embedding data, then retrieves relevant context to stream an answer. It also exposes caller/callee lookup endpoints. The API is the orchestration layer; Neo4j and NVIDIA-hosted models provide storage and language/embedding services. Some pipeline code is omitted from the API excerpt, so the API-to-parser link is marked unverified.

Main entry points: [`api.py`](https://github.com/gurram-rohith/graphrag-backend/blob/main/api.py) (FastAPI endpoints), [`parser.py`](https://github.com/gurram-rohith/graphrag-backend/blob/main/parser.py) (Parse and summarize), [`query_engine.py`](https://github.com/gurram-rohith/graphrag-backend/blob/main/query_engine.py) (Cypher generation), [`ingest.py`](https://github.com/gurram-rohith/graphrag-backend/blob/main/ingest.py) (Clone and filter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API orchestration"]
  node_api["FastAPI endpoints<br/>[api.py]"]
end

subgraph group_ingest["Repository ingestion"]
  node_ingest["Clone and filter<br/>[ingest.py]"]
end

subgraph group_analysis["Code analysis"]
  node_parser["Parse and summarize<br/>[parser.py]"]
  node_ast["Universal parser<br/>[ast_adapter.py]"]
  node_query["Cypher generation<br/>[query_engine.py]"]
end

subgraph group_services["Storage and models"]
  node_config["Service configuration<br/>[config.py]"]
  node_neo4j[("Knowledge graph")]
  node_nvidia["NVIDIA model API"]
end

node_user(("Client"))

node_user -->|"submits requests"| node_api
node_api -->|"starts clone"| node_ingest
node_api -.->|"runs pipeline"| node_parser
node_parser -->|"summarizes and embeds"| node_nvidia
node_parser -->|"writes graph data"| node_neo4j
node_api -->|"queries and resets"| node_neo4j
node_api -->|"embeds and streams answers"| node_nvidia
node_api -->|"requests Cypher"| node_query
node_query -->|"generates Cypher"| node_nvidia

click node_api "https://github.com/gurram-rohith/graphrag-backend/blob/main/api.py"
click node_ingest "https://github.com/gurram-rohith/graphrag-backend/blob/main/ingest.py"
click node_parser "https://github.com/gurram-rohith/graphrag-backend/blob/main/parser.py"
click node_ast "https://github.com/gurram-rohith/graphrag-backend/blob/main/ast_adapter.py"
click node_query "https://github.com/gurram-rohith/graphrag-backend/blob/main/query_engine.py"
click node_config "https://github.com/gurram-rohith/graphrag-backend/blob/main/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_api,node_user toneBlue
class node_ingest toneAmber
class node_parser,node_ast,node_query toneMint
class node_config,node_neo4j,node_nvidia toneRose
```

## Components

### API orchestration

- [FastAPI endpoints](https://github.com/gurram-rohith/graphrag-backend/blob/main/api.py): `api.py`

### Repository ingestion

- [Clone and filter](https://github.com/gurram-rohith/graphrag-backend/blob/main/ingest.py): `ingest.py`

### Code analysis

- [Parse and summarize](https://github.com/gurram-rohith/graphrag-backend/blob/main/parser.py): `parser.py`
- [Universal parser](https://github.com/gurram-rohith/graphrag-backend/blob/main/ast_adapter.py): `ast_adapter.py`
- [Cypher generation](https://github.com/gurram-rohith/graphrag-backend/blob/main/query_engine.py): `query_engine.py`

### Storage and models

- [Service configuration](https://github.com/gurram-rohith/graphrag-backend/blob/main/config.py): `config.py`
- **Knowledge graph**
- **NVIDIA model API**

### Other components

- **Client**

## Connections

- Client → FastAPI endpoints: submits requests (evidence: `api.py`)
- FastAPI endpoints → Clone and filter: starts clone (evidence: `api.py`)
- FastAPI endpoints → Parse and summarize: runs pipeline (evidence: `api.py`)
- Parse and summarize → NVIDIA model API: summarizes and embeds (evidence: `parser.py`)
- Parse and summarize → Knowledge graph: writes graph data (evidence: `parser.py`)
- FastAPI endpoints → Knowledge graph: queries and resets (evidence: `api.py`)
- FastAPI endpoints → NVIDIA model API: embeds and streams answers (evidence: `api.py`)
- FastAPI endpoints → Cypher generation: requests Cypher (evidence: `api.py`)
- Cypher generation → NVIDIA model API: generates Cypher (evidence: `query_engine.py`)
