# nancy-kataria/codebase-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/nancy-kataria/codebase-intelligence
- Repository: https://github.com/nancy-kataria/codebase-intelligence

## Overview

Codebase Intelligence lets a developer submit a GitHub repository, index its code, review an AI-generated overview, and ask repository-grounded questions. The main path runs from the browser’s configuration and processing screens through ingestion, then into summary and chat retrieval; chat streams its answer back to the interface. The README documents language-aware chunking, GitHub access checks, embeddings, and Pinecone storage. Ingestion internals are represented at the route level because its source was read but not excerpted; cleanup automation is omitted as operational infrastructure.

Main entry points: [`app/api/chat/route.ts`](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/chat/route.ts) (Chat endpoint), [`app/api/summarize/route.ts`](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/summarize/route.ts) (Summary endpoint), [`app/api/ingest/route.ts`](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/ingest/route.ts) (Ingestion endpoint), [`app/page.tsx`](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/page.tsx) (Web application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Developer experience"]
  node_browser["Web application<br/>[page.tsx]"]
  node_config["Repository setup"]
  node_processing["Ingestion progress"]
  node_hub["Intelligence hub"]
  node_project_summary["Project overview"]
  node_chat_ui["Chat interface<br/>[ChatInterface.tsx]"]
  node_markdown["Markdown rendering"]
end

subgraph group_api["Analysis APIs"]
  node_summary_api["Summary endpoint<br/>[route.ts]"]
  node_chat_api["Chat endpoint<br/>[route.ts]"]
  node_schemas["Request validation<br/>[schema.ts]"]
  node_types["Domain types<br/>[types.ts]"]
end

subgraph group_indexing["Repository indexing"]
  node_ingest_api["Ingestion endpoint<br/>[route.ts]"]
  node_chunking["Language-aware chunking<br/>[route.ts]"]
end

subgraph group_services["AI and retrieval"]
  node_embed["OpenAI embeddings"]
  node_pinecone_client["Pinecone client<br/>[pinecone.ts]"]
  node_vector_store[("Pinecone index")]
end

node_developer(("Developer"))
node_github["GitHub API"]
node_llm["OpenAI GPT-4o"]

node_developer -->|"uses"| node_browser
node_browser -->|"renders setup"| node_config
node_config -->|"submits repository"| node_browser
node_browser -->|"shows progress"| node_processing
node_processing -->|"posts repository"| node_ingest_api
node_ingest_api -->|"validates request"| node_schemas
node_ingest_api -->|"checks and loads"| node_github
node_ingest_api -->|"splits source files"| node_chunking
node_chunking -->|"embeds code chunks"| node_embed
node_ingest_api -->|"stores vectors"| node_pinecone_client
node_pinecone_client -->|"accesses index"| node_vector_store
node_processing -->|"requests overview"| node_summary_api
node_browser -->|"shows results"| node_hub
node_hub -->|"renders overview"| node_project_summary
node_hub -->|"renders chat"| node_chat_ui
node_chat_ui -->|"renders responses"| node_markdown
node_chat_ui -->|"posts question"| node_chat_api
node_summary_api -->|"validates request"| node_schemas
node_chat_api -->|"validates request"| node_schemas
node_summary_api -->|"embeds overview query"| node_embed
node_summary_api -->|"queries top 100"| node_pinecone_client
node_summary_api -->|"generates analysis"| node_llm
node_chat_api -->|"embeds question"| node_embed
node_chat_api -->|"queries top 10"| node_pinecone_client
node_chat_api -->|"streams grounded answer"| node_llm
node_chat_api -->|"returns answer stream"| node_chat_ui

click node_browser "https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/page.tsx"
click node_config "https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/ConfigurationDashboard.tsx"
click node_processing "https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/ProcessingState.tsx"
click node_hub "https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/IntelligenceHub.tsx"
click node_project_summary "https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/ProjectSummaryCard.tsx"
click node_chat_ui "https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/ChatInterface.tsx"
click node_markdown "https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/markdown-responses.tsx"
click node_ingest_api "https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/ingest/route.ts"
click node_chunking "https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/ingest/route.ts"
click node_pinecone_client "https://github.com/nancy-kataria/codebase-intelligence/blob/main/lib/pinecone.ts"
click node_summary_api "https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/summarize/route.ts"
click node_chat_api "https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/chat/route.ts"
click node_schemas "https://github.com/nancy-kataria/codebase-intelligence/blob/main/lib/schema.ts"
click node_types "https://github.com/nancy-kataria/codebase-intelligence/blob/main/lib/types.ts"

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_browser,node_config,node_processing,node_hub,node_project_summary,node_chat_ui,node_markdown toneBlue
class node_summary_api,node_chat_api,node_schemas,node_types toneAmber
class node_ingest_api,node_chunking,node_github toneMint
class node_embed,node_pinecone_client,node_vector_store toneRose
class node_developer,node_llm toneIndigo
```

## Components

### Developer experience

- [Web application](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/page.tsx): `app/page.tsx`
- [Repository setup](https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/ConfigurationDashboard.tsx): `components/ConfigurationDashboard.tsx`
- [Ingestion progress](https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/ProcessingState.tsx): `components/ProcessingState.tsx`
- [Intelligence hub](https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/IntelligenceHub.tsx): `components/IntelligenceHub.tsx`
- [Project overview](https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/ProjectSummaryCard.tsx): `components/ProjectSummaryCard.tsx`
- [Chat interface](https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/ChatInterface.tsx): `components/ChatInterface.tsx`
- [Markdown rendering](https://github.com/nancy-kataria/codebase-intelligence/blob/main/components/markdown-responses.tsx): `components/markdown-responses.tsx`

### Analysis APIs

- [Summary endpoint](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/summarize/route.ts): `app/api/summarize/route.ts`
- [Chat endpoint](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`
- [Request validation](https://github.com/nancy-kataria/codebase-intelligence/blob/main/lib/schema.ts): `lib/schema.ts`
- [Domain types](https://github.com/nancy-kataria/codebase-intelligence/blob/main/lib/types.ts): `lib/types.ts`

### Repository indexing

- [Ingestion endpoint](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/ingest/route.ts): `app/api/ingest/route.ts`
- [Language-aware chunking](https://github.com/nancy-kataria/codebase-intelligence/blob/main/app/api/ingest/route.ts): `app/api/ingest/route.ts`

### AI and retrieval

- **OpenAI embeddings**
- [Pinecone client](https://github.com/nancy-kataria/codebase-intelligence/blob/main/lib/pinecone.ts): `lib/pinecone.ts`
- **Pinecone index**

### Other components

- **Developer**
- **GitHub API**
- **OpenAI GPT-4o**

## Connections

- Developer → Web application: uses (evidence: `README.md`)
- Web application → Repository setup: renders setup (evidence: `app/page.tsx`)
- Repository setup → Web application: submits repository (evidence: `app/page.tsx`)
- Web application → Ingestion progress: shows progress (evidence: `app/page.tsx`)
- Ingestion progress → Ingestion endpoint: posts repository (evidence: `components/ProcessingState.tsx`)
- Ingestion endpoint → Request validation: validates request (evidence: `README.md`)
- Ingestion endpoint → GitHub API: checks and loads (evidence: `README.md`)
- Ingestion endpoint → Language-aware chunking: splits source files (evidence: `README.md`)
- Language-aware chunking → OpenAI embeddings: embeds code chunks (evidence: `README.md`)
- Ingestion endpoint → Pinecone client: stores vectors (evidence: `README.md`)
- Pinecone client → Pinecone index: accesses index (evidence: `lib/pinecone.ts`)
- Ingestion progress → Summary endpoint: requests overview (evidence: `components/ProcessingState.tsx`)
- Web application → Intelligence hub: shows results (evidence: `app/page.tsx`)
- Intelligence hub → Project overview: renders overview (evidence: `components/IntelligenceHub.tsx`)
- Intelligence hub → Chat interface: renders chat (evidence: `components/IntelligenceHub.tsx`)
- Chat interface → Markdown rendering: renders responses (evidence: `components/ChatInterface.tsx`)
- Chat interface → Chat endpoint: posts question (evidence: `components/ChatInterface.tsx`)
- Summary endpoint → Request validation: validates request (evidence: `app/api/summarize/route.ts`)
- Chat endpoint → Request validation: validates request (evidence: `app/api/chat/route.ts`)
- Summary endpoint → OpenAI embeddings: embeds overview query (evidence: `app/api/summarize/route.ts`)
- Summary endpoint → Pinecone client: queries top 100 (evidence: `app/api/summarize/route.ts`)
- Summary endpoint → OpenAI GPT-4o: generates analysis (evidence: `app/api/summarize/route.ts`)
- Chat endpoint → OpenAI embeddings: embeds question (evidence: `app/api/chat/route.ts`)
- Chat endpoint → Pinecone client: queries top 10 (evidence: `app/api/chat/route.ts`)
- Chat endpoint → OpenAI GPT-4o: streams grounded answer (evidence: `app/api/chat/route.ts`)
- Chat endpoint → Chat interface: returns answer stream (evidence: `README.md`)
