# shashank3876/dev-mind architecture

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

- Interactive diagram: https://gitdiagram.com/shashank3876/dev-mind
- Repository: https://github.com/shashank3876/dev-mind

## Overview

DevMind combines a React client and API services with a Python AI backend and Go webhook gateway. Chat requests pass through FastAPI for history, optional retrieval, and streamed LLM output; document ingestion indexes material for retrieval. Separately, GitHub events enter an asynchronous review pipeline, where a worker fetches diffs, generates feedback, and posts comments. The API server also provides OAuth, billing, usage, and conversation/review services. Edges rely on README flows and indexed caller references; unsampled integrations are represented only where documented.

Main entry points: [`artifacts/api-server/src/app.ts`](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/app.ts) (Express API), [`ai-backend/routes/chat.py`](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/routes/chat.py) (Chat route), [`ai-backend/worker.py`](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/worker.py) (Review worker), [`artifacts/frontend/src/App.tsx`](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/frontend/src/App.tsx) (React app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_frontend["React app<br/>[App.tsx]"]
  node_chat_ui["Chat experience<br/>[use-chat.ts]"]
  node_review_ui["Review experience<br/>[review.tsx]"]
end

subgraph group_api["Product API"]
  node_api_server["Express API<br/>[app.ts]"]
  node_auth["OAuth and sessions<br/>[auth.ts]"]
  node_billing["Billing and quotas<br/>[billing.ts]"]
  node_conversations["Conversation history<br/>[conversations.ts]"]
  node_api_reviews["Review services<br/>[pr-reviews.ts]"]
end

subgraph group_ai["AI and Retrieval"]
  node_fastapi["AI API<br/>[main.py]"]
  node_chat_route["Chat route<br/>[chat.py]"]
  node_ingest["Document ingestion<br/>[ingest.py]"]
  node_rag["RAG retrieval<br/>[rag.py]"]
  node_memory[("Chat memory<br/>[memory.py]")]
  node_review_route["Interactive review<br/>[review.py]"]
  node_review_prompt["Review prompting<br/>[review_prompt.py]"]
  node_llm_router["LLM routing<br/>[router.py]"]
end

subgraph group_automation["PR Automation"]
  node_gateway["Webhook gateway<br/>[main.go]"]
  node_verify["Signature verification<br/>[verify.go]"]
  node_webhook_handler["Webhook handler<br/>[github.go]"]
  node_queue["Redis / PubSub queue<br/>[queue.go]"]
  node_worker["Review worker<br/>[worker.py]"]
  node_github_service["PR diff and comments<br/>[github.py]"]
end

subgraph group_data["Persistence and Providers"]
  node_db[("Application database<br/>[index.ts]")]
  node_providers["LLM providers<br/>[base.py]"]
  node_vector_store[("Vector store")]
end

node_user(("User"))
node_github["GitHub"]

node_user -->|"uses"| node_frontend
node_frontend -.->|"renders"| node_chat_ui
node_frontend -.->|"renders"| node_review_ui
node_chat_ui -->|"sends chat"| node_fastapi
node_review_ui -.->|"uses review API"| node_api_server
node_frontend -.->|"uses product API"| node_api_server
node_api_server -.->|"routes requests"| node_auth
node_api_server -->|"handles billing"| node_billing
node_api_server -.->|"serves history"| node_conversations
node_api_server -->|"serves reviews"| node_api_reviews
node_auth -.->|"persists accounts"| node_db
node_billing -.->|"stores subscriptions"| node_db
node_conversations -.->|"stores history"| node_db
node_api_reviews -.->|"stores reviews"| node_db
node_fastapi -->|"routes requests"| node_chat_route
node_fastapi -->|"routes requests"| node_ingest
node_fastapi -->|"routes requests"| node_review_route
node_chat_route -->|"loads history"| node_memory
node_chat_route -->|"retrieves context"| node_rag
node_chat_route -->|"gets provider"| node_llm_router
node_chat_route -->|"streams answer"| node_user
node_ingest -->|"indexes text"| node_rag
node_rag -->|"reads and writes"| node_vector_store
node_rag -->|"supplies citations"| node_user
node_review_route -->|"fetches diff"| node_github_service
node_review_route -->|"builds prompt"| node_review_prompt
node_review_route -->|"gets provider"| node_llm_router
node_llm_router -->|"selects implementation"| node_providers
node_github -->|"sends webhook"| node_gateway
node_gateway -.->|"verifies signature"| node_verify
node_gateway -.->|"dispatches event"| node_webhook_handler
node_webhook_handler -->|"enqueues job"| node_queue
node_queue -->|"delivers job"| node_worker
node_worker -->|"fetches diff"| node_github_service
node_worker -->|"builds prompt"| node_review_prompt
node_worker -->|"gets provider"| node_llm_router
node_worker -->|"posts comment"| node_github_service
node_github_service -->|"fetches and comments"| node_github

click node_frontend "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/frontend/src/App.tsx"
click node_chat_ui "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/frontend/src/hooks/use-chat.ts"
click node_review_ui "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/frontend/src/pages/review.tsx"
click node_api_server "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/app.ts"
click node_auth "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/routes/auth.ts"
click node_billing "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/services/billing.ts"
click node_conversations "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/services/conversations.ts"
click node_api_reviews "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/services/pr-reviews.ts"
click node_db "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/lib/db/src/schema/index.ts"
click node_fastapi "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/main.py"
click node_chat_route "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/routes/chat.py"
click node_ingest "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/routes/ingest.py"
click node_rag "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/rag.py"
click node_memory "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/memory.py"
click node_review_route "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/routes/review.py"
click node_review_prompt "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/review_prompt.py"
click node_llm_router "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/llm/router.py"
click node_providers "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/llm/base.py"
click node_vector_store "https://github.com/shashank3876/dev-mind/tree/test/pr-review-v2/ai-backend/services/vectorstore"
click node_gateway "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/main.go"
click node_verify "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/middleware/verify.go"
click node_webhook_handler "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/handlers/github.go"
click node_queue "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/queue/queue.go"
click node_worker "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/worker.py"
click node_github_service "https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/github.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_chat_ui,node_review_ui,node_user toneBlue
class node_api_server,node_auth,node_billing,node_conversations,node_api_reviews toneAmber
class node_fastapi,node_chat_route,node_ingest,node_rag,node_memory,node_review_route,node_review_prompt,node_llm_router toneMint
class node_gateway,node_verify,node_webhook_handler,node_queue,node_worker,node_github_service toneRose
class node_db,node_providers,node_vector_store,node_github toneIndigo
```

## Components

### Client

- [React app](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/frontend/src/App.tsx): `artifacts/frontend/src/App.tsx`
- [Chat experience](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/frontend/src/hooks/use-chat.ts): `artifacts/frontend/src/hooks/use-chat.ts`
- [Review experience](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/frontend/src/pages/review.tsx): `artifacts/frontend/src/pages/review.tsx`

### Product API

- [Express API](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/app.ts): `artifacts/api-server/src/app.ts`
- [OAuth and sessions](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/routes/auth.ts): `artifacts/api-server/src/routes/auth.ts`
- [Billing and quotas](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/services/billing.ts): `artifacts/api-server/src/services/billing.ts`
- [Conversation history](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/services/conversations.ts): `artifacts/api-server/src/services/conversations.ts`
- [Review services](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/artifacts/api-server/src/services/pr-reviews.ts): `artifacts/api-server/src/services/pr-reviews.ts`

### AI and Retrieval

- [AI API](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/main.py): `ai-backend/main.py`
- [Chat route](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/routes/chat.py): `ai-backend/routes/chat.py`
- [Document ingestion](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/routes/ingest.py): `ai-backend/routes/ingest.py`
- [RAG retrieval](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/rag.py): `ai-backend/services/rag.py`
- [Chat memory](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/memory.py): `ai-backend/services/memory.py`
- [Interactive review](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/routes/review.py): `ai-backend/routes/review.py`
- [Review prompting](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/review_prompt.py): `ai-backend/services/review_prompt.py`
- [LLM routing](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/llm/router.py): `ai-backend/services/llm/router.py`

### PR Automation

- [Webhook gateway](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/main.go): `main.go`
- [Signature verification](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/middleware/verify.go): `middleware/verify.go`
- [Webhook handler](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/handlers/github.go): `handlers/github.go`
- [Redis / PubSub queue](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/queue/queue.go): `queue/queue.go`
- [Review worker](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/worker.py): `ai-backend/worker.py`
- [PR diff and comments](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/github.py): `ai-backend/services/github.py`

### Persistence and Providers

- [Application database](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/lib/db/src/schema/index.ts): `lib/db/src/schema/index.ts`
- [LLM providers](https://github.com/shashank3876/dev-mind/blob/test/pr-review-v2/ai-backend/services/llm/base.py): `ai-backend/services/llm/base.py`
- [Vector store](https://github.com/shashank3876/dev-mind/tree/test/pr-review-v2/ai-backend/services/vectorstore): `ai-backend/services/vectorstore`

### Other components

- **User**
- **GitHub**

## Connections

- User → React app: uses
- React app → Chat experience: renders
- React app → Review experience: renders
- Chat experience → AI API: sends chat
- Review experience → Express API: uses review API
- React app → Express API: uses product API
- Express API → OAuth and sessions: routes requests (evidence: `artifacts/api-server/src/app.ts`)
- Express API → Billing and quotas: handles billing (evidence: `artifacts/api-server/src/app.ts`)
- Express API → Conversation history: serves history
- Express API → Review services: serves reviews
- OAuth and sessions → Application database: persists accounts
- Billing and quotas → Application database: stores subscriptions
- Conversation history → Application database: stores history
- Review services → Application database: stores reviews
- AI API → Chat route: routes requests (evidence: `ai-backend/main.py`)
- AI API → Document ingestion: routes requests (evidence: `ai-backend/main.py`)
- AI API → Interactive review: routes requests (evidence: `ai-backend/main.py`)
- Chat route → Chat memory: loads history (evidence: `ai-backend/routes/chat.py`)
- Chat route → RAG retrieval: retrieves context (evidence: `ai-backend/routes/chat.py`)
- Chat route → LLM routing: gets provider (evidence: `ai-backend/routes/chat.py`)
- Chat route → User: streams answer
- Document ingestion → RAG retrieval: indexes text (evidence: `ai-backend/routes/ingest.py`)
- RAG retrieval → Vector store: reads and writes (evidence: `ai-backend/services/rag.py`)
- RAG retrieval → User: supplies citations
- Interactive review → PR diff and comments: fetches diff (evidence: `ai-backend/routes/review.py`)
- Interactive review → Review prompting: builds prompt (evidence: `ai-backend/routes/review.py`)
- Interactive review → LLM routing: gets provider (evidence: `ai-backend/routes/review.py`)
- LLM routing → LLM providers: selects implementation (evidence: `ai-backend/services/llm/router.py`)
- GitHub → Webhook gateway: sends webhook
- Webhook gateway → Signature verification: verifies signature
- Webhook gateway → Webhook handler: dispatches event
- Webhook handler → Redis / PubSub queue: enqueues job
- Redis / PubSub queue → Review worker: delivers job
- Review worker → PR diff and comments: fetches diff (evidence: `ai-backend/worker.py`)
- Review worker → Review prompting: builds prompt (evidence: `ai-backend/worker.py`)
- Review worker → LLM routing: gets provider (evidence: `ai-backend/worker.py`)
- Review worker → PR diff and comments: posts comment (evidence: `ai-backend/worker.py`)
- PR diff and comments → GitHub: fetches and comments
