# harshbarnwal0101/software-knowledge-graph architecture

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

- Interactive diagram: https://gitdiagram.com/harshbarnwal0101/software-knowledge-graph
- Repository: https://github.com/harshbarnwal0101/software-knowledge-graph

## Overview

Software Knowledge Graph ingests GitHub repositories into relational records, a Neo4j symbol/dependency graph, and Qdrant vectors, then exposes exploration, search, chat, history, impact, health, and patch capabilities through a web app. The documented main workflow is user → Next.js → FastAPI → repository analysis; sampled ingestion code confirms clone, parse, graph construction, and embedding stages. Some feature implementations are represented at their exact directories because their source was not excerpted; those links are documented or marked unverified rather than inferred from names alone.

Main entry points: [`backend/app/api/routes/repositories.py`](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/api/routes/repositories.py) (Repository routes), [`backend/app/services/ingestion_service.py`](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/ingestion_service.py) (Ingestion orchestration), [`backend/app/main.py`](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/main.py) (FastAPI entry), [`backend/app/services/impact_service.py`](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/impact_service.py) (Impact analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_frontend["Next.js application"]
  node_repo_ui["Repository views"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API and identity"]
  node_api_entry["FastAPI entry<br/>[main.py]"]
  node_auth["Authentication routes<br/>[auth.py]"]
  node_repo_routes["Repository routes<br/>[repositories.py]"]
  node_deps["Auth dependencies<br/>[deps.py]"]
end

subgraph group_ingest["Repository analysis"]
  node_ingestion["Ingestion orchestration"]
  node_git["Git operations<br/>[git_service.py]"]
  node_parsers["Language parsing"]
end

subgraph group_intelligence["Code intelligence"]
  node_impact["Impact analysis<br/>[impact_service.py]"]
  node_agent["Codebase agent"]
  node_hybrid["Hybrid search<br/>[hybrid_search.py]"]
  node_patch["Patch proposals<br/>[patch_service.py]"]
  node_history["Git history<br/>[git_service.py]"]
  node_health["Repository health"]
end

subgraph group_state["Persistence and indexes"]
  node_relational[("Relational records<br/>[database.py]")]
  node_graph[("Knowledge graph<br/>[neo4j_service.py]")]
  node_vectors[("Vector index<br/>[vector_service.py]")]
  node_embeddings["Embedding generation"]
end

node_user(("User"))
node_llm{{"LLM service"}}

node_user -->|"uses"| node_frontend
node_frontend -->|"calls API"| node_api_entry
node_api_entry -->|"registers routes"| node_auth
node_api_entry -->|"registers routes"| node_repo_routes
node_repo_routes -->|"starts analysis"| node_ingestion
node_repo_routes -->|"requests analysis"| node_impact
node_repo_routes -->|"requests answers"| node_agent
node_repo_routes -->|"requests search"| node_hybrid
node_repo_routes -->|"requests graph"| node_graph
node_repo_routes -->|"requests patch"| node_patch
node_auth -->|"uses identity"| node_deps
node_ingestion -->|"clones repository"| node_git
node_ingestion -->|"parses files"| node_parsers
node_ingestion -->|"stores records"| node_relational
node_ingestion -->|"builds graph"| node_graph
node_ingestion -->|"indexes chunks"| node_vectors
node_vectors -->|"embeds text"| node_embeddings
node_impact -->|"queries dependencies"| node_graph
node_impact -->|"reads symbols"| node_relational
node_patch -->|"reads checkout"| node_git
node_agent -.->|"retrieves context"| node_hybrid
node_agent -.->|"asks questions"| node_llm
node_hybrid -.->|"searches vectors"| node_vectors
node_repo_ui -.->|"uses client"| node_api_client

click node_frontend "https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/frontend/app"
click node_repo_ui "https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/frontend/app/repositories/%5Bid%5D"
click node_api_client "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/frontend/lib/api.js"
click node_api_entry "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/main.py"
click node_auth "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/api/routes/auth.py"
click node_repo_routes "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/api/routes/repositories.py"
click node_deps "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/api/deps.py"
click node_ingestion "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/ingestion_service.py"
click node_git "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/git_service.py"
click node_parsers "https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/backend/app/parsers"
click node_impact "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/impact_service.py"
click node_agent "https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/backend/app/agents"
click node_hybrid "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/retrieval/hybrid_search.py"
click node_patch "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/patch_service.py"
click node_history "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/git_service.py"
click node_health "https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/backend/app/services"
click node_relational "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/core/database.py"
click node_graph "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/graph/neo4j_service.py"
click node_vectors "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/retrieval/vector_service.py"
click node_embeddings "https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/embeddings/embedding_service.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_frontend,node_repo_ui,node_api_client,node_user toneBlue
class node_api_entry,node_auth,node_repo_routes,node_deps toneAmber
class node_ingestion,node_git,node_parsers toneMint
class node_impact,node_agent,node_hybrid,node_patch,node_history,node_health toneRose
class node_relational,node_graph,node_vectors,node_embeddings,node_llm toneIndigo
```

## Components

### Web application

- [Next.js application](https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/frontend/app): `frontend/app`
- [Repository views](https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/frontend/app/repositories/%5Bid%5D): `frontend/app/repositories/[id]`
- [API client](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/frontend/lib/api.js): `frontend/lib/api.js`

### API and identity

- [FastAPI entry](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Repository routes](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/api/routes/repositories.py): `backend/app/api/routes/repositories.py`
- [Auth dependencies](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`

### Repository analysis

- [Ingestion orchestration](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/ingestion_service.py): `backend/app/services/ingestion_service.py`
- [Git operations](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/git_service.py): `backend/app/services/git_service.py`
- [Language parsing](https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/backend/app/parsers): `backend/app/parsers`

### Code intelligence

- [Impact analysis](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/impact_service.py): `backend/app/services/impact_service.py`
- [Codebase agent](https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/backend/app/agents): `backend/app/agents`
- [Hybrid search](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/retrieval/hybrid_search.py): `backend/app/retrieval/hybrid_search.py`
- [Patch proposals](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/patch_service.py): `backend/app/services/patch_service.py`
- [Git history](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/services/git_service.py): `backend/app/services/git_service.py`
- [Repository health](https://github.com/harshbarnwal0101/software-knowledge-graph/tree/main/backend/app/services): `backend/app/services`

### Persistence and indexes

- [Relational records](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Knowledge graph](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/graph/neo4j_service.py): `backend/app/graph/neo4j_service.py`
- [Vector index](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/retrieval/vector_service.py): `backend/app/retrieval/vector_service.py`
- [Embedding generation](https://github.com/harshbarnwal0101/software-knowledge-graph/blob/main/backend/app/embeddings/embedding_service.py): `backend/app/embeddings/embedding_service.py`

### Other components

- **User**
- **LLM service**

## Connections

- User → Next.js application: uses (evidence: `README.md`)
- Next.js application → FastAPI entry: calls API (evidence: `README.md`)
- FastAPI entry → Authentication routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI entry → Repository routes: registers routes (evidence: `backend/app/main.py`)
- Repository routes → Ingestion orchestration: starts analysis (evidence: `backend/app/api/routes/repositories.py`)
- Repository routes → Impact analysis: requests analysis (evidence: `backend/app/api/routes/repositories.py`)
- Repository routes → Codebase agent: requests answers (evidence: `backend/app/api/routes/repositories.py`)
- Repository routes → Hybrid search: requests search (evidence: `backend/app/api/routes/repositories.py`)
- Repository routes → Knowledge graph: requests graph (evidence: `backend/app/api/routes/repositories.py`)
- Repository routes → Patch proposals: requests patch (evidence: `backend/app/api/routes/repositories.py`)
- Authentication routes → Auth dependencies: uses identity (evidence: `backend/app/api/routes/auth.py`)
- Ingestion orchestration → Git operations: clones repository (evidence: `backend/app/services/ingestion_service.py`)
- Ingestion orchestration → Language parsing: parses files (evidence: `backend/app/services/ingestion_service.py`)
- Ingestion orchestration → Relational records: stores records (evidence: `backend/app/services/ingestion_service.py`)
- Ingestion orchestration → Knowledge graph: builds graph (evidence: `backend/app/services/ingestion_service.py`)
- Ingestion orchestration → Vector index: indexes chunks (evidence: `backend/app/services/ingestion_service.py`)
- Vector index → Embedding generation: embeds text (evidence: `backend/app/retrieval/vector_service.py`)
- Impact analysis → Knowledge graph: queries dependencies (evidence: `backend/app/services/impact_service.py`)
- Impact analysis → Relational records: reads symbols (evidence: `backend/app/services/impact_service.py`)
- Patch proposals → Git operations: reads checkout (evidence: `backend/app/services/patch_service.py`)
- Codebase agent → Hybrid search: retrieves context
- Codebase agent → LLM service: asks questions
- Hybrid search → Vector index: searches vectors
- Repository views → API client: uses client
