# qwerty1347/devtalk architecture

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

- Interactive diagram: https://gitdiagram.com/qwerty1347/devtalk
- Repository: https://github.com/qwerty1347/devtalk

## Overview

devTalk is a serverless RAG chat over indexed development notes. Users ask in the chat UI; the chat route embeds the question, retrieves matching Pinecone chunks, and asks Gemini to answer with sources. Separate GitHub, local-folder, and Google Drive indexers extract documents, chunk and embed them, then store vectors. The web UI also offers resumable GitHub indexing. The README documents additional Drive image description and Google Docs support; those capabilities are represented, though their full implementation paths were not sampled. Edges reflect excerpts, SOURCE INDEX references, or README workflow statements; unsampled details are not inferred.

Main entry points: [`lib/gemini.ts`](https://github.com/qwerty1347/devtalk/blob/main/lib/gemini.ts) (Gemini embeddings and answers), [`app/api/index/route.ts`](https://github.com/qwerty1347/devtalk/blob/main/app/api/index/route.ts) (Web index route), [`scripts/index-github.ts`](https://github.com/qwerty1347/devtalk/blob/main/scripts/index-github.ts) (GitHub indexer), [`scripts/index-local.ts`](https://github.com/qwerty1347/devtalk/blob/main/scripts/index-local.ts) (Local indexer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Chat experience"]
  node_chat_ui["Chat UI<br/>[page.tsx]"]
  node_index_panel["Index panel<br/>[IndexPanel.tsx]"]
end

subgraph group_runtime["RAG runtime"]
  node_chat_api["Chat route<br/>[route.ts]"]
  node_gemini["Gemini embeddings and answers<br/>[gemini.ts]"]
end

subgraph group_ingestion["Document indexing"]
  node_index_api["Web index route<br/>[route.ts]"]
  node_github_indexer["GitHub indexer<br/>[index-github.ts]"]
  node_local_indexer["Local indexer<br/>[index-local.ts]"]
  node_drive_indexer["Drive indexer<br/>[index.ts]"]
  node_chunking["Text chunking<br/>[chunk.ts]"]
  node_id_generation["Vector IDs<br/>[id.ts]"]
  node_env_loading["Environment loading<br/>[loadEnv.ts]"]
end

subgraph group_connectors["Sources and storage"]
  node_github_source["GitHub documents<br/>[github.ts]"]
  node_local_source["Local documents<br/>[localfiles.ts]"]
  node_drive_source["Drive documents<br/>[drive.ts]"]
  node_pinecone_client["Vector operations<br/>[pinecone.ts]"]
  node_pinecone[("Pinecone index")]
end

node_user(("User"))
node_github["GitHub"]
node_filesystem["Local filesystem"]
node_google_drive["Google Drive"]
node_gemini_service["Gemini service"]

node_user -->|"asks question"| node_chat_ui
node_chat_ui -->|"submits question"| node_chat_api
node_chat_api -->|"embeds query"| node_gemini
node_chat_api -->|"searches vectors"| node_pinecone_client
node_chat_api -->|"requests answer"| node_gemini
node_gemini -->|"calls models"| node_gemini_service
node_pinecone_client -->|"queries and upserts"| node_pinecone
node_chat_api -->|"returns answer and sources"| node_chat_ui
node_user -->|"starts indexing"| node_index_panel
node_index_panel -->|"requests indexing"| node_index_api
node_index_api -->|"lists and fetches"| node_github_source
node_index_api -->|"chunks text"| node_chunking
node_index_api -->|"embeds documents"| node_gemini
node_index_api -->|"creates vector IDs"| node_id_generation
node_index_api -->|"checks and upserts"| node_pinecone_client
node_github_indexer -->|"reads documents"| node_github_source
node_github_indexer -->|"chunks documents"| node_chunking
node_github_indexer -->|"embeds documents"| node_gemini
node_github_indexer -->|"creates vector IDs"| node_id_generation
node_github_indexer -->|"upserts vectors"| node_pinecone_client
node_local_indexer -->|"reads documents"| node_local_source
node_local_indexer -->|"chunks documents"| node_chunking
node_local_indexer -->|"embeds documents"| node_gemini
node_local_indexer -->|"creates vector IDs"| node_id_generation
node_local_indexer -->|"upserts vectors"| node_pinecone_client
node_drive_indexer -->|"lists and downloads"| node_drive_source
node_drive_indexer -->|"embeds and describes"| node_gemini
node_drive_indexer -->|"chunks extracted text"| node_chunking
node_drive_indexer -->|"upserts vectors"| node_pinecone_client
node_github_source -->|"fetches repository data"| node_github
node_local_source -.->|"reads files"| node_filesystem
node_drive_source -->|"lists and downloads"| node_google_drive
node_env_loading -->|"loads script config"| node_github_indexer
node_env_loading -->|"loads script config"| node_local_indexer
node_env_loading -->|"loads script config"| node_drive_indexer

click node_chat_ui "https://github.com/qwerty1347/devtalk/blob/main/app/page.tsx"
click node_index_panel "https://github.com/qwerty1347/devtalk/blob/main/app/IndexPanel.tsx"
click node_chat_api "https://github.com/qwerty1347/devtalk/blob/main/app/api/chat/route.ts"
click node_index_api "https://github.com/qwerty1347/devtalk/blob/main/app/api/index/route.ts"
click node_github_indexer "https://github.com/qwerty1347/devtalk/blob/main/scripts/index-github.ts"
click node_local_indexer "https://github.com/qwerty1347/devtalk/blob/main/scripts/index-local.ts"
click node_drive_indexer "https://github.com/qwerty1347/devtalk/blob/main/scripts/index.ts"
click node_chunking "https://github.com/qwerty1347/devtalk/blob/main/lib/chunk.ts"
click node_id_generation "https://github.com/qwerty1347/devtalk/blob/main/lib/id.ts"
click node_env_loading "https://github.com/qwerty1347/devtalk/blob/main/lib/loadEnv.ts"
click node_github_source "https://github.com/qwerty1347/devtalk/blob/main/lib/github.ts"
click node_local_source "https://github.com/qwerty1347/devtalk/blob/main/lib/localfiles.ts"
click node_drive_source "https://github.com/qwerty1347/devtalk/blob/main/lib/drive.ts"
click node_gemini "https://github.com/qwerty1347/devtalk/blob/main/lib/gemini.ts"
click node_pinecone_client "https://github.com/qwerty1347/devtalk/blob/main/lib/pinecone.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_chat_ui,node_index_panel,node_user toneBlue
class node_chat_api,node_gemini toneAmber
class node_index_api,node_github_indexer,node_local_indexer,node_drive_indexer,node_chunking,node_id_generation,node_env_loading toneMint
class node_github_source,node_local_source,node_drive_source,node_pinecone_client,node_pinecone toneRose
class node_github,node_filesystem,node_google_drive,node_gemini_service toneIndigo
```

## Components

### Chat experience

- [Chat UI](https://github.com/qwerty1347/devtalk/blob/main/app/page.tsx): `app/page.tsx`
- [Index panel](https://github.com/qwerty1347/devtalk/blob/main/app/IndexPanel.tsx): `app/IndexPanel.tsx`

### RAG runtime

- [Chat route](https://github.com/qwerty1347/devtalk/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`
- [Gemini embeddings and answers](https://github.com/qwerty1347/devtalk/blob/main/lib/gemini.ts): `lib/gemini.ts`

### Document indexing

- [Web index route](https://github.com/qwerty1347/devtalk/blob/main/app/api/index/route.ts): `app/api/index/route.ts`
- [GitHub indexer](https://github.com/qwerty1347/devtalk/blob/main/scripts/index-github.ts): `scripts/index-github.ts`
- [Local indexer](https://github.com/qwerty1347/devtalk/blob/main/scripts/index-local.ts): `scripts/index-local.ts`
- [Drive indexer](https://github.com/qwerty1347/devtalk/blob/main/scripts/index.ts): `scripts/index.ts`
- [Text chunking](https://github.com/qwerty1347/devtalk/blob/main/lib/chunk.ts): `lib/chunk.ts`
- [Vector IDs](https://github.com/qwerty1347/devtalk/blob/main/lib/id.ts): `lib/id.ts`
- [Environment loading](https://github.com/qwerty1347/devtalk/blob/main/lib/loadEnv.ts): `lib/loadEnv.ts`

### Sources and storage

- [GitHub documents](https://github.com/qwerty1347/devtalk/blob/main/lib/github.ts): `lib/github.ts`
- [Local documents](https://github.com/qwerty1347/devtalk/blob/main/lib/localfiles.ts): `lib/localfiles.ts`
- [Drive documents](https://github.com/qwerty1347/devtalk/blob/main/lib/drive.ts): `lib/drive.ts`
- [Vector operations](https://github.com/qwerty1347/devtalk/blob/main/lib/pinecone.ts): `lib/pinecone.ts`
- **Pinecone index**

### Other components

- **User**
- **GitHub**
- **Local filesystem**
- **Google Drive**
- **Gemini service**

## Connections

- User → Chat UI: asks question (evidence: `README.md`)
- Chat UI → Chat route: submits question (evidence: `README.md`)
- Chat route → Gemini embeddings and answers: embeds query (evidence: `app/api/chat/route.ts`)
- Chat route → Vector operations: searches vectors (evidence: `app/api/chat/route.ts`)
- Chat route → Gemini embeddings and answers: requests answer (evidence: `app/api/chat/route.ts`)
- Gemini embeddings and answers → Gemini service: calls models (evidence: `README.md`)
- Vector operations → Pinecone index: queries and upserts (evidence: `README.md`)
- Chat route → Chat UI: returns answer and sources (evidence: `app/api/chat/route.ts`)
- User → Index panel: starts indexing (evidence: `app/IndexPanel.tsx`)
- Index panel → Web index route: requests indexing (evidence: `app/IndexPanel.tsx`)
- Web index route → GitHub documents: lists and fetches (evidence: `app/api/index/route.ts`)
- Web index route → Text chunking: chunks text (evidence: `app/api/index/route.ts`)
- Web index route → Gemini embeddings and answers: embeds documents (evidence: `app/api/index/route.ts`)
- Web index route → Vector IDs: creates vector IDs (evidence: `app/api/index/route.ts`)
- Web index route → Vector operations: checks and upserts (evidence: `app/api/index/route.ts`)
- GitHub indexer → GitHub documents: reads documents (evidence: `scripts/index-github.ts`)
- GitHub indexer → Text chunking: chunks documents (evidence: `scripts/index-github.ts`)
- GitHub indexer → Gemini embeddings and answers: embeds documents (evidence: `scripts/index-github.ts`)
- GitHub indexer → Vector IDs: creates vector IDs (evidence: `scripts/index-github.ts`)
- GitHub indexer → Vector operations: upserts vectors (evidence: `scripts/index-github.ts`)
- Local indexer → Local documents: reads documents (evidence: `scripts/index-local.ts`)
- Local indexer → Text chunking: chunks documents (evidence: `scripts/index-local.ts`)
- Local indexer → Gemini embeddings and answers: embeds documents (evidence: `scripts/index-local.ts`)
- Local indexer → Vector IDs: creates vector IDs (evidence: `scripts/index-local.ts`)
- Local indexer → Vector operations: upserts vectors (evidence: `scripts/index-local.ts`)
- Drive indexer → Drive documents: lists and downloads (evidence: `scripts/index.ts`)
- Drive indexer → Gemini embeddings and answers: embeds and describes (evidence: `scripts/index.ts`)
- Drive indexer → Text chunking: chunks extracted text (evidence: `scripts/index.ts`)
- Drive indexer → Vector operations: upserts vectors (evidence: `scripts/index.ts`)
- GitHub documents → GitHub: fetches repository data (evidence: `lib/github.ts`)
- Local documents → Local filesystem: reads files
- Drive documents → Google Drive: lists and downloads (evidence: `lib/drive.ts`)
- Environment loading → GitHub indexer: loads script config (evidence: `scripts/index-github.ts`)
- Environment loading → Local indexer: loads script config (evidence: `scripts/index-local.ts`)
- Environment loading → Drive indexer: loads script config (evidence: `scripts/index.ts`)
