# nhahub/nha-4-156 architecture

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

- Interactive diagram: https://gitdiagram.com/nhahub/nha-4-156
- Repository: https://github.com/nhahub/nha-4-156

## Overview

Astrolabe lets users submit a GitHub repository, ingest it into a searchable index, then explore it through chat, insights, charts, and generated documentation. The graph includes the documented capability branches, OAuth/private-repository access, and persistent state. Source excerpts are partial, so unshown route internals and some frontend request wiring are omitted rather than inferred.

Main entry points: [`frontend/src/lib/api.jsx`](https://github.com/nhahub/nha-4-156/blob/main/frontend/src/lib/api.jsx) (API client), [`ingestion/pipeline.py`](https://github.com/nhahub/nha-4-156/blob/main/ingestion/pipeline.py) (Ingestion coordinator), [`api/routes/ingestion.py`](https://github.com/nhahub/nha-4-156/blob/main/api/routes/ingestion.py) (Ingestion endpoints), [`llm/chatbot.py`](https://github.com/nhahub/nha-4-156/blob/main/llm/chatbot.py) (ReAct code assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User interface"]
  node_home["Repository submission<br/>[App.jsx]"]
  node_repo_view["Repository workspace"]
  node_chat_ui["Chat interface<br/>[ChatWindow.jsx]"]
  node_api_client["API client<br/>[api.jsx]"]
  node_auth_ui["Auth state<br/>[auth.jsx]"]
end

subgraph group_access["Identity and access"]
  node_oauth["GitHub OAuth<br/>[auth.py]"]
  node_authorization["Repository authorization<br/>[auth.py]"]
  node_token_security["Token encryption<br/>[security.py]"]
end

subgraph group_ingestion["Repository ingestion"]
  node_ingest_route["Ingestion endpoints<br/>[ingestion.py]"]
  node_pipeline["Ingestion coordinator<br/>[pipeline.py]"]
  node_preprocessor["Repository preparation<br/>[preprocessor.py]"]
  node_loader["File loading<br/>[loader.py]"]
  node_chunker["Language-aware chunking<br/>[chunker.py]"]
  node_embeddings["Embedding providers<br/>[provider.py]"]
end

subgraph group_exploration["Code exploration"]
  node_chat_route["Chat endpoints<br/>[chat.py]"]
  node_chatbot["ReAct code assistant<br/>[chatbot.py]"]
  node_agent_tools["Repository tools<br/>[agent_tools.py]"]
  node_reranker["Result reranker<br/>[reranker.py]"]
  node_insight_route["Insight endpoints<br/>[insight.py]"]
  node_insight_generator["Insight agent"]
  node_charts_route["Charts endpoints<br/>[charts.py]"]
  node_analytics["Chart analytics<br/>[visualizer.py]"]
  node_docs_route["Documentation endpoints<br/>[docs.py]"]
  node_doc_generator["Documentation generator"]
end

subgraph group_persistence["Persistent state"]
  node_vectorstore[("Vector index store<br/>[chroma_store.py]")]
  node_database[("SQLite application data<br/>[database.py]")]
end

node_user(("Repository explorer"))
node_github{{"GitHub"}}
node_llm_service{{"Cloud LLM providers"}}

node_user -->|"submits repository"| node_home
node_home -->|"starts ingestion"| node_api_client
node_home -->|"polls status"| node_api_client
node_user -->|"signs in"| node_auth_ui
node_auth_ui -->|"requests OAuth"| node_oauth
node_oauth -->|"exchanges code"| node_github
node_oauth -->|"persists user"| node_database
node_authorization -->|"checks grants"| node_database
node_authorization -->|"probes access"| node_github
node_database -->|"stores encrypted token"| node_token_security
node_api_client -->|"HTTP requests"| node_ingest_route
node_ingest_route -->|"checks repository access"| node_authorization
node_ingest_route -->|"runs ingestion"| node_pipeline
node_ingest_route -->|"records status"| node_database
node_pipeline -->|"prepares repository"| node_preprocessor
node_pipeline -->|"loads files"| node_loader
node_pipeline -->|"chunks documents"| node_chunker
node_pipeline -->|"configures embeddings"| node_embeddings
node_pipeline -->|"inserts vectors"| node_vectorstore
node_preprocessor -->|"clones repository"| node_github
node_api_client -->|"loads workspace data"| node_repo_view
node_repo_view -->|"renders chat"| node_chat_ui
node_api_client -->|"HTTP requests"| node_chat_route
node_chat_route -->|"runs chat"| node_chatbot
node_chatbot -->|"uses exploration tools"| node_agent_tools
node_chatbot -->|"loads reranker"| node_reranker
node_chatbot -.->|"queries index"| node_vectorstore
node_chatbot -.->|"requests completions"| node_llm_service
node_api_client -->|"HTTP requests"| node_insight_route
node_insight_route -->|"generates insights"| node_insight_generator
node_insight_generator -.->|"requests completions"| node_llm_service
node_api_client -->|"HTTP requests"| node_charts_route
node_charts_route -->|"builds charts"| node_analytics
node_charts_route -->|"reads chart cache"| node_database
node_api_client -->|"HTTP requests"| node_docs_route
node_docs_route -->|"generates documentation"| node_doc_generator
node_doc_generator -.->|"requests completions"| node_llm_service
node_ingest_route -->|"grants repository access"| node_authorization

click node_home "https://github.com/nhahub/nha-4-156/blob/main/frontend/src/App.jsx"
click node_repo_view "https://github.com/nhahub/nha-4-156/blob/main/frontend/src/pages/RepoIllustrationPage.jsx"
click node_chat_ui "https://github.com/nhahub/nha-4-156/blob/main/frontend/src/components/ChatWindow.jsx"
click node_api_client "https://github.com/nhahub/nha-4-156/blob/main/frontend/src/lib/api.jsx"
click node_auth_ui "https://github.com/nhahub/nha-4-156/blob/main/frontend/src/lib/auth.jsx"
click node_oauth "https://github.com/nhahub/nha-4-156/blob/main/api/routes/auth.py"
click node_authorization "https://github.com/nhahub/nha-4-156/blob/main/api/auth.py"
click node_token_security "https://github.com/nhahub/nha-4-156/blob/main/api/security.py"
click node_ingest_route "https://github.com/nhahub/nha-4-156/blob/main/api/routes/ingestion.py"
click node_pipeline "https://github.com/nhahub/nha-4-156/blob/main/ingestion/pipeline.py"
click node_preprocessor "https://github.com/nhahub/nha-4-156/blob/main/ingestion/preprocessor.py"
click node_loader "https://github.com/nhahub/nha-4-156/blob/main/ingestion/loader.py"
click node_chunker "https://github.com/nhahub/nha-4-156/blob/main/ingestion/chunker.py"
click node_embeddings "https://github.com/nhahub/nha-4-156/blob/main/embeddings/provider.py"
click node_vectorstore "https://github.com/nhahub/nha-4-156/blob/main/vectorstore/chroma_store.py"
click node_chat_route "https://github.com/nhahub/nha-4-156/blob/main/api/routes/chat.py"
click node_chatbot "https://github.com/nhahub/nha-4-156/blob/main/llm/chatbot.py"
click node_agent_tools "https://github.com/nhahub/nha-4-156/blob/main/rag/agent_tools.py"
click node_reranker "https://github.com/nhahub/nha-4-156/blob/main/rag/reranker.py"
click node_insight_route "https://github.com/nhahub/nha-4-156/blob/main/api/routes/insight.py"
click node_insight_generator "https://github.com/nhahub/nha-4-156/blob/main/rag/insight_generator.py"
click node_charts_route "https://github.com/nhahub/nha-4-156/blob/main/api/routes/charts.py"
click node_analytics "https://github.com/nhahub/nha-4-156/blob/main/insights/visualizer.py"
click node_docs_route "https://github.com/nhahub/nha-4-156/blob/main/api/routes/docs.py"
click node_doc_generator "https://github.com/nhahub/nha-4-156/blob/main/insights/document_generator.py"
click node_database "https://github.com/nhahub/nha-4-156/blob/main/api/database.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_home,node_repo_view,node_chat_ui,node_api_client,node_auth_ui toneBlue
class node_oauth,node_authorization,node_token_security toneAmber
class node_ingest_route,node_pipeline,node_preprocessor,node_loader,node_chunker,node_embeddings toneMint
class node_chat_route,node_chatbot,node_agent_tools,node_reranker,node_insight_route,node_insight_generator,node_charts_route,node_analytics,node_docs_route,node_doc_generator toneRose
class node_vectorstore,node_database,node_user,node_github,node_llm_service toneIndigo
```

## Components

### User interface

- [Repository submission](https://github.com/nhahub/nha-4-156/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Repository workspace](https://github.com/nhahub/nha-4-156/blob/main/frontend/src/pages/RepoIllustrationPage.jsx): `frontend/src/pages/RepoIllustrationPage.jsx`
- [Chat interface](https://github.com/nhahub/nha-4-156/blob/main/frontend/src/components/ChatWindow.jsx): `frontend/src/components/ChatWindow.jsx`
- [API client](https://github.com/nhahub/nha-4-156/blob/main/frontend/src/lib/api.jsx): `frontend/src/lib/api.jsx`
- [Auth state](https://github.com/nhahub/nha-4-156/blob/main/frontend/src/lib/auth.jsx): `frontend/src/lib/auth.jsx`

### Identity and access

- [GitHub OAuth](https://github.com/nhahub/nha-4-156/blob/main/api/routes/auth.py): `api/routes/auth.py`
- [Repository authorization](https://github.com/nhahub/nha-4-156/blob/main/api/auth.py): `api/auth.py`
- [Token encryption](https://github.com/nhahub/nha-4-156/blob/main/api/security.py): `api/security.py`

### Repository ingestion

- [Ingestion endpoints](https://github.com/nhahub/nha-4-156/blob/main/api/routes/ingestion.py): `api/routes/ingestion.py`
- [Ingestion coordinator](https://github.com/nhahub/nha-4-156/blob/main/ingestion/pipeline.py): `ingestion/pipeline.py`
- [Repository preparation](https://github.com/nhahub/nha-4-156/blob/main/ingestion/preprocessor.py): `ingestion/preprocessor.py`
- [File loading](https://github.com/nhahub/nha-4-156/blob/main/ingestion/loader.py): `ingestion/loader.py`
- [Language-aware chunking](https://github.com/nhahub/nha-4-156/blob/main/ingestion/chunker.py): `ingestion/chunker.py`
- [Embedding providers](https://github.com/nhahub/nha-4-156/blob/main/embeddings/provider.py): `embeddings/provider.py`

### Code exploration

- [Chat endpoints](https://github.com/nhahub/nha-4-156/blob/main/api/routes/chat.py): `api/routes/chat.py`
- [ReAct code assistant](https://github.com/nhahub/nha-4-156/blob/main/llm/chatbot.py): `llm/chatbot.py`
- [Repository tools](https://github.com/nhahub/nha-4-156/blob/main/rag/agent_tools.py): `rag/agent_tools.py`
- [Result reranker](https://github.com/nhahub/nha-4-156/blob/main/rag/reranker.py): `rag/reranker.py`
- [Insight endpoints](https://github.com/nhahub/nha-4-156/blob/main/api/routes/insight.py): `api/routes/insight.py`
- [Insight agent](https://github.com/nhahub/nha-4-156/blob/main/rag/insight_generator.py): `rag/insight_generator.py`
- [Charts endpoints](https://github.com/nhahub/nha-4-156/blob/main/api/routes/charts.py): `api/routes/charts.py`
- [Chart analytics](https://github.com/nhahub/nha-4-156/blob/main/insights/visualizer.py): `insights/visualizer.py`
- [Documentation endpoints](https://github.com/nhahub/nha-4-156/blob/main/api/routes/docs.py): `api/routes/docs.py`
- [Documentation generator](https://github.com/nhahub/nha-4-156/blob/main/insights/document_generator.py): `insights/document_generator.py`

### Persistent state

- [Vector index store](https://github.com/nhahub/nha-4-156/blob/main/vectorstore/chroma_store.py): `vectorstore/chroma_store.py`
- [SQLite application data](https://github.com/nhahub/nha-4-156/blob/main/api/database.py): `api/database.py`

### Other components

- **Repository explorer**
- **GitHub**
- **Cloud LLM providers**

## Connections

- Repository explorer → Repository submission: submits repository (evidence: `frontend/src/App.jsx`)
- Repository submission → API client: starts ingestion (evidence: `frontend/src/App.jsx`)
- Repository submission → API client: polls status (evidence: `frontend/src/App.jsx`)
- Repository explorer → Auth state: signs in (evidence: `frontend/src/lib/auth.jsx`)
- Auth state → GitHub OAuth: requests OAuth (evidence: `frontend/src/lib/auth.jsx`)
- GitHub OAuth → GitHub: exchanges code
- GitHub OAuth → SQLite application data: persists user (evidence: `api/routes/auth.py`)
- Repository authorization → SQLite application data: checks grants (evidence: `api/auth.py`)
- Repository authorization → GitHub: probes access (evidence: `api/auth.py`)
- SQLite application data → Token encryption: stores encrypted token (evidence: `api/auth.py`)
- API client → Ingestion endpoints: HTTP requests (evidence: `frontend/src/lib/api.jsx`)
- Ingestion endpoints → Repository authorization: checks repository access (evidence: `api/routes/ingestion.py`)
- Ingestion endpoints → Ingestion coordinator: runs ingestion (evidence: `api/routes/ingestion.py`)
- Ingestion endpoints → SQLite application data: records status (evidence: `api/routes/ingestion.py`)
- Ingestion coordinator → Repository preparation: prepares repository (evidence: `ingestion/pipeline.py`)
- Ingestion coordinator → File loading: loads files (evidence: `ingestion/pipeline.py`)
- Ingestion coordinator → Language-aware chunking: chunks documents (evidence: `ingestion/pipeline.py`)
- Ingestion coordinator → Embedding providers: configures embeddings (evidence: `ingestion/pipeline.py`)
- Ingestion coordinator → Vector index store: inserts vectors (evidence: `ingestion/pipeline.py`)
- Repository preparation → GitHub: clones repository (evidence: `ingestion/preprocessor.py`)
- API client → Repository workspace: loads workspace data (evidence: `frontend/src/pages/RepoIllustrationPage.jsx`)
- Repository workspace → Chat interface: renders chat (evidence: `frontend/src/pages/RepoIllustrationPage.jsx`)
- API client → Chat endpoints: HTTP requests (evidence: `README.md`)
- Chat endpoints → ReAct code assistant: runs chat (evidence: `api/routes/chat.py`)
- ReAct code assistant → Repository tools: uses exploration tools (evidence: `llm/chatbot.py`)
- ReAct code assistant → Result reranker: loads reranker (evidence: `llm/chatbot.py`)
- ReAct code assistant → Vector index store: queries index
- ReAct code assistant → Cloud LLM providers: requests completions
- API client → Insight endpoints: HTTP requests (evidence: `README.md`)
- Insight endpoints → Insight agent: generates insights (evidence: `api/routes/insight.py`)
- Insight agent → Cloud LLM providers: requests completions
- API client → Charts endpoints: HTTP requests (evidence: `README.md`)
- Charts endpoints → Chart analytics: builds charts (evidence: `api/routes/charts.py`)
- Charts endpoints → SQLite application data: reads chart cache (evidence: `api/routes/charts.py`)
- API client → Documentation endpoints: HTTP requests (evidence: `README.md`)
- Documentation endpoints → Documentation generator: generates documentation (evidence: `api/routes/docs.py`)
- Documentation generator → Cloud LLM providers: requests completions
- Ingestion endpoints → Repository authorization: grants repository access (evidence: `api/routes/ingestion.py`)
